CompuServe Messages

FOR…BY -1 bug

    26-May-89 22:26:18
Sb: #8779-FOR…BY -1 bug
Fm: M2S/Phil Camp 76004,2054
To: bob hawkins 70345,425
The problem lies with the statement DEC(i) within the FOR loop. This is not allowed in the Modula-2 language. Quoting from "Programming in Modula-2" 3rd edition, page 36: (…) "no components of the expression determining the range must be affected by the repeated statements, and, above all, the control variable itself must not be changed by the repeated statements" So basically, you cannot legally attempt to modify the variable "i" within the scope of the FOR loop. You'll see that by removing the DEC(i) statement, all works fine.