next up previous contents index
Next: Conditional Assignment Up: Variables and Expressions Previous: Vector Operations   Contents   Index

Implicit Loops

It is sometimes convenient to assign to an array values which are functions of the array indices. This can be done using ``implicit loops'', such as

      DEFINE REAL A[10,10]
      LET A[I,J] = EXP(-((I-5)|2)**2-((J-6)|3)**2)
in which I and J have NOT been declared as known variables. I and J are known as ``implicit variables''. The preceding expression is equivalent to the following commands
      DEFINE REAL A[10,10]
      FOR J 1 TO 10      
      FOR I 1 TO 10
      LET A[I,J] = EXP(-((I-5)|2)**2-((J-6)|3)**2)
      NEXT
      NEXT
but it executes thousands of times faster... Mixing of implicit and declared (or loop) variables is strictly forbidden at present. It can usually be avoided by using intermediate arrays.



Gildas manager 2014-07-01