Assignment Statement Syntax
The assignment statement is used to assign a value to a variable in a Fractal Science Kit fractal program.
The basic syntax is:
<Variable> = <Expression>
The expression is evaluated and the resulting value is assigned to the variable.
Be forewarned that unlike some other languages, assignment does not produce a value, so statements with several variables separated by the = character cannot be used to initialize several variables to the same value as in:
a = b = c
This, in fact, will set a to the result of the expression b=c. That is, the 2nd = is interpreted as the equality comparison operator, the expression b=c is evaluated, and the resulting Boolean value is assigned to a.
Several additional forms of assignment combine an arithmetic operation with the assignment:
<Variable> += <Expression>
These are functionally equivalent to the following:
<Variable> = <Variable> + (<Expression>)
z += 1 ' z = z + 1
In the above example, the trailing comments provide functionally equivalent statements to those to the left of the comments.
Copyright © 2004-2019 Ross Hilbert