Break | Continue | while | repeat | Upward for | Downward for



Break | Continue | while | repeat | Upward for | Downward for
Pas2JS pascal source code
var i : Integer; BEGIN WriteLn('Upward for'); for i:=1 to 10 do begin if (i and 1)=0 then continue; if i>7 then break; WriteLn(i); end; { CONSOLE OUTPUTS Upward for 1 3 5 7 } WriteLn('Downward for'); for i:=10 downto 1 do begin if (i and 1)=0 then continue; if i<4 then break; WriteLn(i); end; { CONSOLE OUTPUTS Downward for 9 7 5 } WriteLn('While'); i:=1; while i<=10 do begin if (i and 1)=0 then begin i:=i+1; continue; end; if i>7 then break; WriteLn(i); i:=i+1; end; { CONSOLE OUTPUTS While 1 3 5 7 } WriteLn('Repeat'); i:=1; repeat if (i and 1)=0 then begin i:=i+1; continue; end; if i>7 then break; WriteLn(i); i:=i+1; until i>10; { CONSOLE OUTPUTS Repeat 1 3 5 7 }