Remote Processing CAMBASIC User Manual

Page 85

Advertising
background image

Comm ands - 52

FRE

Function

SYNTAX:

a = FRE(0)
a = FRE(c$)

PURPOSE:

Returns the number of bytes of unused but allocated string space, or the number of bytes left for
program and variables. Also performs "gar bage collection" on string space.

REMARK S:

The argument 0 returns the number of bytes which are currently unused and available for program
and variables.

When the argument is any string variable (variable name does not matter), the number of bytes of
unused string space is returned. It also clears up unused string space (garbage collection).
Executing this function, FR E(c$), just before a section of code that manipulates a lot of strings can
speed up program execution.

RELATED:

none

EXAMPLE:

On power– up, you type:

PRINT FRE(0) ; FRE(A$)

35210 100

The first number is the bytes for program s and all variables. The second is the default string. The
line below increases the str ing space to 1000 bytes.

CLEAR 1000

PRINT FRE(0) ; FRE(A$)

34310 1000

Notice that the unused string space is now 1000, which reduced the total program and variable space
by 900 bytes.

ERROR:

none

Advertising