Futurebasic/Language/Reference/let

LETEdit

SyntaxEdit

1.[LET] var = expr
2.[LET] var;length = address&

DescriptionEdit

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 "pseudo" record (declared using DIM var.constant), then expr must be a record variable declared with the same length as var.
  • If var is a "true" 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 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 AlsoEdit

DIM; DIM RECORD; BEGIN RECORD; BLOCKMOVE; DEF BLOCKFILL; Constant declaration statement