include xpllib; \for Print def \S\ Start, Stop, Incr, Comment; int S, Examples, I, J, C, Empty; def Limit = 10; [Examples:= [ [-2, 2, 1, "Normal"], [-2, 2, 0, "Zero increment"], [-2, 2, -1, "Increments away from stop value"], [-2, 2, 10, "First increment is beyond stop value"], [2, -2, 1, "Start more than stop: positive increment"], [2, 2, 1, "Start equal stop: positive increment"], [2, 2, -1, "Start equal stop: negative increment"], [2, 2, 0, "Start equal stop: zero increment"], [0, 0, 0, "Start equal stop equal zero: zero increment"] ]; for I:= 0 to 9-1 do [S:= Examples(I); Print("%s\n", S(Comment)); Print("Range(%d, %d, %d) -> [", S(Start), S(Stop), S(Incr)); Empty:= true; \\ for (j:= s.start, c:= 0; j <= s.stop && c < limit; j += s.incr, ++c) J:= S(Start); C:= 0; while J <= S(Stop) and C < Limit do [Print("%d ", J); Empty:= false; J:= J + S(Incr); C:= C+1; ]; if not Empty then ChOut(0, $08 \BS\); Print("]\n\n"); ] ]