Repository navigation
Operator Let Assignment
Home › Operators › Operator Let() (Assignment)
Assigns fields of a user defined type to a list of variables
Let( variable1 [, variable2 [, ... ]] ) = UDT_var
Let( variable1 [, variable2 [, ... ]] ) => UDT_varvariable1 [, variable2 [, ... ]] Comma separated list of variables to receive the values of the UDTUDT_var
Assigns the values from the UDT_var variable's fields to the list of variables.
When the 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.
- Only available in the -lang fb dialect.
- New to FreeBASIC
Type Vector3D
x As Double
y As Double
z As Double
End Type
Dim a As Vector3D = ( 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 = "; yOutput:
x = 5
y = 7Type Parent
Dim As Integer p1, p2
End Type
Type Child Extends Parent
Dim As Integer c1, c2
End Type
Type GrandChild Extends Child
Dim As Integer 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 Parent p
Dim As Child c
Let(c, i1, i2) = gc
Print c.p1, c.p2, c.c1, c.c2, i1, i2
Let(p, j1, j2) = gc
Print p.p1, p.p2, j1, j2Output:
1 2 3 4 5 6
1 2 5 6Category: Operators
Kind: operator
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing