Created
January 21, 2013 17:43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODULE T22WhileElsif; | |
IMPORT Out; | |
VAR i : INTEGER; | |
BEGIN | |
i := 0; | |
WHILE i = 6 DO Out.String("C"); Out.Ln; i := 123; | |
ELSIF i = 0 DO Out.String("A"); Out.Ln; i := -1 | |
ELSIF i < 0 DO Out.String("B"); Out.Ln; i := 6; | |
END; | |
WHILE i > -10 DO | |
DEC( i, 5 ); Out.Int( i, 0 ); Out.Ln | |
END; | |
END T22WhileElsif. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Out; | |
class T22WhileElsif | |
{ | |
var i : INTEGER; | |
public static function main() | |
{ | |
i = 0; | |
while (true) | |
{ | |
if ( i == 6 ) | |
{ | |
Out.String( "C" ); | |
Out.Ln( ); | |
i = 123; | |
} | |
else if ( i == 0 ) | |
{ | |
Out.String( "A" ); | |
Out.Ln( ); | |
i = -1; | |
} | |
else if ( i < 0 ) | |
{ | |
Out.String( "B" ); | |
Out.Ln( ); | |
i = 6; | |
} | |
else break; | |
} | |
while (true) | |
{ | |
if ( i > -10 ) | |
{ | |
DEC( i, 5 ); | |
Out.Int( i, 0 ); | |
Out.Ln( ); | |
} | |
else break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment