RosettaCodeData/Task/Loops-Wrong-ranges/PL-I/loops-wrong-ranges.pli
2023-07-01 13:44:08 -04:00

33 lines
761 B
Text

loops:procedure options (main);
declare i fixed binary;
put skip list ('-2 to 2 by 1:');
do i = -2 to 2 by 1;
put edit (i) (f(3));
end;
put skip list ('-2 to 2 by 0: infinite loop, prints -2');
put skip list ('-2 to 2 by -1: [no values printed]');
do i = -2 to 2 by -1;
put edit (i) (f(3));
end;
put skip list ('-2 to 2 by 10:');
do i = -2 to 2 by 1;
put edit (i) (f(3));
end;
put skip list (' 2 to 2 by 1:');
do i = 2 to 2 by 1;
put edit (i) (f(3));
end;
put skip list (' 2 to 2 by -1:');
do i = 2 to 2 by -1;
put edit (i) (f(3));
end;
put skip list (' 2 to 2 by 0: infinite loop, prints 2');
put skip list (' 0 to 0 by 0: infinite loop, prints 0');
end loops;