Syntax:
1.[let] var = expr
2.[let] var;length = address&
Description:
The let
statement assigns a value to the variable var
, replacing whatever value var
had before. Note that the let
keyword is optional.
- If you use Syntax 1, the value of
expr
is assigned to var
:
- If
var
is a numeric variable, then expr
can be any numeric expression; if expr
is outside the range or precision that can be stored in var
, then the expression will be appropriately converted.
- If
var
is a pointer variable, then expr
can be _nil (zero), or another pointer variable of the same type, or any valid address expression.
- If
var
is a Handle variable, then expr
can be _nil (zero), or another Handle variable of the same type, or any valid address expression whose value is a handle.
- If
var
is a string variable, then expr
can be any string expression. You should make sure that the length of expr
does not exceed the maximum string size that will fit into var
.
- If
var
is a "record" declared using dim var as recordType
, then expr
must be a record variable of the same type as var
.
If you use Syntax 2, then length
bytes are copied into var
, from the memory location starting at address&
. The length
parameter must be a static integer expression (i.e., it cannot contain any variables). Note that FutureBasic does not check whether length
actually equals the size of var
. If length
is too small, an incomplete value will be copied into var
; if length
is too big, data will be copied into addresses beyond var
's location in memory (this can be dangerous).
See Also:
dim; begin record; BlockMove; BlockFill; Constant declaration statement