NIPO ODIN Version 5.17
*REPNUM
Purpose
Condition on repetition number.
Syntax
*REPNUM <n|[expression]>: <action> [*ELSE <action>]
Description
This command can only be used inside a repetition block. It compares the current repetition with the number indicated by n . If these are equal the commands after the colon are executed. Optionally you can use the command *ELSE after which you place commands that are executed if the current repetition is not equal to n .
Arguments
n|expression This is a positive integer that indicates the repetition number to be compared.
Remarks
- The repetition number is stored in the system variable
?R . - The colon in the syntax may be used as a separator between the condition and the action. It may also be left out.
- The commands
*RANDOM , *ROT , *INV and *ORDER do not change the repetition number, but do change the order in which the repeat block is executed.
Example
*TEXTVARS who *REPEAT 5 *FIELD 86L10 *REPNUM 1: *PUT who "Johnny" *REPNUM 2: *PUT who "Mary" *REPNUM 3: *PUT who "Bill" *REPNUM 4: *PUT who "Anne" *REPNUM 5: *PUT who "Joey"
*QUESTION 1 *NUMBER 1L2 How old is *? who?
*ENDREP
In this example, question 1 is repeated 5 times. The answer of each question is stored in the data field 86L10 (for each answer 2 positions (1L2 x 5 questions).
|