Rockwell Automation 2708-DH5B2L_DH5B4L Attended Workstation User Manual

Page 154

Advertising
background image

A-B VBASIC and Visual BASIC

Appendix L

Differences Between

L–7

Found = TRUE
EXIT DO

END IF

LOOP
CLOSE #1

EXIT {DO/FOR/FUNCTION/SUB}

Exits a DO...LOOP or FOR...NEXT loop, FUNCTION, or SUB. See DO,
FOR, FUNCTION, and SUB for particular statement being ended. See
VBDOS manual for detailed information. See previous entry for example.

FIX(x)

Returns the truncated integer part of x.

FOR counter = start TO end [STEP increment]

...

NEXT [counter]

Repeats a group of instructions a specified number of times. The data type
of the counter controls the precision of the start, end and increment
expressions. The following needs to be a LONG integer:

WRONG: FOR J% = 1 to 80000: statements: NEXT J%
RIGHT: FOR J& = 1 TO 80000: statements: NEXT J&

In order to count backwards (end < start), you must use the STEP clause and
specify a negative value. (Historical note: I and J are commonly used
because they are handy integers in FORTRAN. You can make your counter
variable anything you want!)

FRE(numeric expression)

FRE(stringexpression)<—NOT VALID
Returns the available memory. Numeric expressions 0 through 3 are the only
ones supported, and have different meanings than under VBDOS:

ProgMem% = FRE(0)

When the numeric expression evaluates to 0, an INTEGER is returned
representing the number of bytes remaining for program pseudo–code,
variable data, and the program’s pseudo stack.

FileMem& = FRE(1)

When the numeric expression evaluates to 1, a LONG is returned
representing the number of bytes which can be used by files. (Because
files are allocated in memory by blocks, rather than a byte at a time, this
value will decrement by some multiple of 256.)

FREEFILE

Returns the next free BASIC file number, or 0 when all file numbers are “in
use”, i.e. are assigned to open files or devices. A-B VBASIC and VBDOS

Advertising
This manual is related to the following products: