beautypg.com

Dec & decf – Remote Processing CAMBASIC User Manual

Page 63

background image

Comm ands - 30

DEC & DECF

Statements

SYNTAX:

DEC variable

DEC F var iable

PURPOSE:

To decrem ent a variable by one (DEC) or four (DEC F).

REMARK S:

This is a fast way to decrement a simple or array variable.

A = A– 1

slow

D E C A

fast

A = A– 4

slow

D E C F A

fast

DEC executes more than twice as fast as the statement it replaces. Valid for simple and array
variables.

RELATED:

I N C , I N C F

EXAMPLE:

10 A = 4
20 DEC A
30 PRINT A
40 DECF A
50 PRINT A
RUN
3
–1

ERROR:

< Expected variable> – if parameter is not a variable