into to IF \& ELSE

This commit is contained in:
antranigv 2017-06-02 17:53:29 +04:00
parent bb888c228e
commit d3bfe2ac3f
No known key found for this signature in database
GPG key ID: 60686B14DAB81456
2 changed files with 52 additions and 0 deletions

42
ifelse/IfElse.Mod Normal file
View file

@ -0,0 +1,42 @@
MODULE ifelse;
IMPORT Out;
VAR n, m : INTEGER;
BEGIN
IF 8 MOD 4 = 0
THEN
Out.String("8 is divisible by 4"); Out.Ln;
END;
n := 7; m := 6;
IF n * m = 42
THEN
Out.String("7 times 6 equals 42"); Out.Ln;
END;
IF n # m THEN Out.String("7 does not equal 6"); Out.Ln; END;
IF ODD(n)
THEN
Out.String("7 is odd"); Out.Ln;
ELSE
Out.String("7 is even"); Out.Ln;
END;
n := 9;
IF n < 0
THEN
Out.Int(n, 0); Out.String(" is negative"); Out.Ln;
ELSIF n < 10
THEN
Out.Int(n, 0); Out.String(" has 1 digit"); Out.Ln;
ELSE
Out.Int(n, 0); Out.String(" has multiple digits"); Out.Ln;
END;
END ifelse.

10
ifelse/Makefile Normal file
View file

@ -0,0 +1,10 @@
VOC = /opt/voc/bin/voc
all:
$(VOC) -m IfElse.Mod
clean:
rm *.c
rm *.h
rm *.o
rm *.sym