Conditional Assignment

  This special assignment is intended to change a property or other variable that has already a default value, when a new value is given.
The := symbol assign conditionally a variable, if the expression is not nil .
The error structure is set to "true" if the expression to assign is nil.

Example:
x := z
error ? print "z is nil"

The above assignment is equivalent to:
if (z nil) let x = z

Only simple assignments may be conditional and can use the := symbol.

Examples og conditional assignments.
When x is not assigned, the 15 value is assigned to it, then the 100 values also but is null and is not assigned.
int x
int y = null

x := 15
x := 100
x := y

print x
Display: > 100

 Exercises
1) In the following program, x is set to null, guess what the program will assign, "ok" or "not assigned"?
Verify by writting the program.

int x = null
int y = 25

x := y
if x = null
  print "not assigned"
else
  print "ok"
/if


Answer (run the program)