Other programming languages use isolated semicolons as empty instructions. In Rexx programs, isolated semicolons are not empty instructions. The NOP instruction is explicitly used for this purpose instead. For example, after the then or else keyword of an if instruction group another instruction is required. The following program is erroneous:
say 'Please enter your favorite color:'
parse pull color if color = 'RED' then ; /* <-- ERROR !!! */ else say 'your favorite color is not red' |
The correct way to program this in Rexx uses the NOP instruction instead.
say 'Please enter your favorite color:'
parse pull color if color = 'RED' then nop /* <-- ah, this is correct */ else say 'your favorite color is not red' |
Similarly, for a select instruction group, after the then keyword of a when clause an instruction must be provided. When an instruction is absent error code 9 (unexpected when or otherwise) is raised. For example, the following program is erroneous:
say 'Please enter your favorite color:'
parse pull color select when color = 'RED' then ; /* <-- ERROR !!! */ otherwise say 'your favorite color is not red' end |
The correct way to program this in Rexx uses the NOP instruction instead.
say 'Please enter your favorite color:'
parse pull color select when color = 'RED' then nop /* <-- ah, this is correct */ otherwise say 'your favorite color is not red' end |