beautypg.com

Inc and incf – Remote Processing CAMBASIC User Manual

Page 91

background image

Comm ands - 58

INC and INCF

Statements

SYNTAX:

I N C variable

I N C F variable

PURPOSE:

To increment a variable by one (INC) or four (INC F). IN CF is usually used to increment a pointer
for floating point number storage.

REMARK S:

This is a fast increment of a simple or array variable.

A= A+ 1

slow

I N C A

fast

A= A+ 4

slow

I N C F A

fast

INC executes more than double the speed of the statement it replaces. Valid for simple and array
variables.

RELATED:

D E C , D E C F

EXAMPLE:

10 PRINT H
20 INC H
30 PRINT H
RUN
0
1

Line 10 increments element 8 of the array A.

10 INC A(8)

INCF is used to increment a pointer to a floating point number. The following example stores 15
floating point numbers to RAM segment 1.

fptr = &1000
do 15

a = ain(0) *.00232
fpoke fptr,a,1
incf fptr

enddo

ERROR:

< Expected variable> – if parameter is not a variable