next up previous contents index
Next: Character Handling and Logic Up: Arithmetic Previous: Other Functions

Arithmetic Assignment Statements

  An arithmetic assignment statement has the form:
arithmetic-var = arithmetic-expression
where arithmetic-var can be an arithmetic variable or array element. For example, the following assignment statement is valid provided that N, K, and ANGLE are all defined values:
IMAGE(N/2+1,3*K-1) = SIN(ANGLE)**2 + 1.0
If the object on the left has a different data type from that of the expression on the right then a data type conversion is applied automatically. The type conversion function (INT, REAL, DBLE, or CMPLX) is selected to match the object on the left. Note that many type conversions lose information. If the object on the left is an array element, its subscripts can be arbitrary integer expressions, but all the operands in these expressions must be defined before the statement is executed and each must be in the range declared for the corresponding subscript of the array.

Remember with an integer item on the left and an expression of one of the floating-point types, the INT function is invoked: if the NINT function is really needed then it must be used explicitly to convert the value of the expression.


next up previous contents index
Next: Character Handling and Logic Up: Arithmetic Previous: Other Functions
Helen Rowlands
8/27/1998