Futurebasic/Language/Reference/let
(Redirected from Futurebasic/language/reference/let)
LET
editSyntax
edit1.[LET] var = expr
2.
[LET] var;length = address&
Description
editThe 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 tovar
: - If
var
is a numeric variable, thenexpr
can be any numeric expression; ifexpr
is outside the range or precision that can be stored invar
, then the expression will be appropriately converted. - If
var
is a POINTER variable, thenexpr
can be _nil (zero), or another POINTER variable of the same type, or any valid address expression. - If
var
is a HANDLE variable, thenexpr
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, thenexpr
can be any string expression. You should make sure that the length ofexpr
does not exceed the maximum string size that will fit intovar
. - If
var
is a "pseudo" record (declared usingDIM var.constant
), thenexpr
must be a record variable declared with the same length asvar
. - If
var
is a "true" record (declared usingDIM var AS recordType
), thenexpr
must be a record variable of the same type asvar
.
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 FB 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
editDIM; DIM RECORD; BEGIN RECORD; BLOCKMOVE; DEF BLOCKFILL; Constant declaration statement