© Tyl Software Foundation 2019-2021
▶ VARIABLE ASSIGNMENT
Assignment of Multiple Scalar Variables
Tyl permits assignment of multiple scalar variables in one assignment line:
numa numb 21
The code can be denoted:
This one line does:
( 21 → numb ) → numa
This one line does:
- Declare
numa
- Declare
numb
21 → numb
21 → numa
To understand this, let's use
print
function with the parameter 21
print 21
This line of code yields the value 21. Then this value can be assigned to
a variable:
num print 21
num
gets the result of the statement print 21
, which is 21.
In Tyl, the result of a statement is usually its own value or its returned value:
num 21
The result of the assignment will be the value 21.
For any statement, prepending it with
So we can write also:
For any statement, prepending it with
print
will print its result. Another option is to use the
debug print
function, which logs the result in
a debug file.
So we can write also:
print num 21
The system will print 21, which is the result of the statement
So in the statement:
num 21
.
So in the statement:
numa numb 21
The system first declares
numa
. Then the statement numb 21
, declares numb
,
assignes it the value 21, which yields the result 21. The result 21 is then
assigned to numa
.