Assignment Command

The left hand side of an assignment is a variable or array element. Its type determines the type of the expression on the left hand side.

     Left = Expression

You can also use the familiar shorthand notation combining an operator with the equal sign.

   Count += 1                          :Increment a counter.

When assigning a value to a pointer the expression can be a value or an address expression. A value will be assigned to the object that it points to. An address expression always begins with an at sign (@). The expression can be the address of a variable or array element, an address result returned from a function, or a positive constant value up to 65535.

   Pointer = Expression                :Assign a value to a referenced object.
   Pointer = @Variable                 :Point to a variable.
   Pointer = @Array[ Index ]           :Point to an array element.
   Pointer = @Function( Argument )     :Set to the address returned.
   Pointer = @0                        :Set to a positive constant.
   Pointer = @parcel{ I + J }          :Set to a computed 16 bit value.

A conditional assignment evaluates a condition and then updates the result accordingly. There are three different formats you can use. The first assigns zero if the condition is false and one if true. The left hand side must be a numeric or enumerated type.

   Variable = if Condition             :Set Variable to 0 or 1.

Operator assignments also work for conditional assignments. This example increments the Count variable only when the condition is true.

   Count += if Value > 0               :Conditionally increment the Count.

The second conditional form returns a designated value when true. Otherwise the value is unchanged. In this case the assignment Variable may be a string.

   Variable = if Condition, Expression     :Single value conditional format
   Text = if Value < 0, "-" ! Text         :Single value conditional example

   IF Condition                            :Equivalent conditional block
      Variable = Expression
   .

   Variable *= if Condition, Expression    :Single value with operator format
   Odd[ N ] += if N /\ 1, N                :Single value with operator example

   IF Condition                            :Equivalent conditional block
      Variable = Variable * (Expression)
   .

The two value conditional form specifies both a true and a false values. The assignment Variable may be a string here as well. Note that for operator-assignments the only string operator is concatenation (!).

   Variable = if Condition, True, False    :Two value conditional format
   N = if Value > 0, Value, 0              :Two value conditional example

   IF Condition                            :Equivalent conditional block
      Variable = True                      :Assign the expression for True.

   ELSE
      Variable = False                     :Assign the expression for False.
   .

   Variable *= if Condition, True, False   :Two value with operator format
   Text != if Value => 0, "+", "-"         :Two value with operator example

   IF Condition                            :Equivalent conditional block
      Variable = Variable * (True)         :Assign the expression for True.

   ELSE
      Variable = Variable * (False)        :Assign the expression for False.
   .

Intrinsic Function

If Condition