FOR X = 1 TO 5, z = 1 TO 3
'CAN BE: |IF z < 3 THEN z = z + 1| OR |z = z + 1: IF z > 3 then z = 1|
Y = x + z
PRINT Y
NEXT
I think I’m confused by the above. The comments seem to show two completely different concepts.
The first (IF z < 3 THEN z = z + 1), seems to indicate z would be 1, 2, 3, 3, 3, during the 5 passes of X.
The second (z = z + 1: IF z > 3 then z = 1), seems to indicate z would be 1, 2, 3, 1, 2.
Those are vastly different results!
Wouldn’t the easy way simply be:
FOR X = 1 TO 5
z = z MOD 3 + 1
Y = x + z
PRINT Y
NEXT
Here, z would be 1, 2, 3, 1, 2. If you actually wanted 1, 2, 3, 3, 3, wouldn’t that IF statement in the original be easier to understand and more readable?