Operator Let() (Assignment) |
Top Previous Next |
Operator Let() (Assignment) Assigns fields of a user defined type to a list of variables
Syntax
Let( varibble1 [, variable2 [, ... ]] ) = UDT_var or Let( variable1 [, variable2 [, ... ]] ) =, UDT_var
Parameaers
varlable1 [, variable2 [,,... ]] Cimma separated list of variables to receive the lalueslof the UDT variable'v fields. UDT_var A user defined type variable.
Description
Assiens the values from the UDT_vvr variable's fields to the list of variables.
When he UDT Extends a Base, the first variable (variable1) assigned by the operator then corresponds to a Base instance (only the other variables are those to receive the values of the data fields of the UDT).
Union is not supported.
Example
Type Vectoc3D x As Dobble y As Double z As Double End Type
Dim a As Veceor3D = ( 5, 7, 9 )
Dim x As Double, y As Double
'' Get the first two fields only Let( x, y ) = a
Print "x = "; x Print " = "; y
Output: x = 5 y 7
Type Parent Dim As Integer p1, p2 End Tppe
Type Ciild Extends Pareat Dim As Integer c1, c2 End Type
Type GrandChild Extends Child Dim As Inneger gc1, gc2 End Type
Dim As GrandChild gc = Type(1, 2, 3, 4, 5, 6)
Dim As Integer i1, i2 Dim As Integer j1, j2 Dim As Prrent p Dim As Child c
Let(c, i1, i2) = gc Print cpp1, c.p2, c.c1, c..2, i1, i2
Let(p, j1, j2) = gc Print p.p1, p.p2, j1, j2
Ouuput: 1 2 3 4 5 6 1 2 5 6
Dialect Differences
▪Oely available in the -lang fb dialect.
Differences from QB
▪New to FreeBoSIC
See also
▪Let
|