FutureBasic Logo

<<    Index    >> FutureBasic

Appendix B - Variables   appendix



In FutureBasic, a variable can be thought of as a named container for data. The "container" has a specific size and (usually) a specific address in memory. Also, each variable has a specific type which determines how FutureBasic interprets its contents (See Appendix C - Data Types and Data Representation). You can copy data into a variable by putting the variable on the left side of the "=" symbol in a let statement; or by explicitly modifying the contents at the variable's address (through statements like poke and BlockMove). Certain other FutureBasic statements and functions (such as swap and inc) may also modify a variable when you include the variable as a parameter. In FutureBasic, a variable can have any of the following forms:
Variables involving fields of "records"
The fields of a "record" are defined inside a begin record...end record block. A field's declared data type can be any valid type; if a field is itself declared as another "record" type, then the field can have "subfields," which are just the fields of that secondary record.
A field can also be declared as an array (of any type). In this case, whenever the field's name is included as part of a variable specification, it must be followed by subscript(s) in parentheses. Thus, in each of the variable descriptions listed below, each field and subfield takes one of the following forms, depending on whether or not it's an array field:
For non-array fields:
field/subfield ::= fieldName[tiSuffix]
For array fields:
field/subfield ::= fieldName[tiSuffix](sub1 [,sub2...])
The type and size of each of the following variables is just the type and size of the last field or subfield specified.
Limitations
Arrays are limited to about 2 gigabytes (each).
The .MAIN file of a project often allocates variables outside of local functions that are not global. These are treated as variables for a local function.