Smart pascal source code
procedure WriteLnIntRange(const value : Integer);
begin
case value of
-2..-1 : WriteLn('negative');
0 : WriteLn('zero');
5, 10 : WriteLn('multiple of five');
1..4, 6..9 : WriteLn('between 1 and 9 but 5');
else
WriteLn('elsewhere');
end;
end;
var
i : Integer;
BEGIN
for i:=-3 to 11 do begin
WriteLn(IntToStr(i)+Chr(32));
WriteLnIntRange(i);
end;
case 'Hello' of
'Bonjour'..'Icare' : WriteLn('Hello!');
'Alpha'..'Omega' : WriteLn('oopsie!');
else
WriteLn('oopsie!');
end;
{ ### CONSOLE OUTPUTS ###
-3 elsewhere
-2 negative
-1 negative
0 zero
1 between 1 and 9 but 5
2 between 1 and 9 but 5
3 between 1 and 9 but 5
4 between 1 and 9 but 5
5 multiple of five
6 between 1 and 9 but 5
7 between 1 and 9 but 5
8 between 1 and 9 but 5
9 between 1 and 9 but 5
10 multiple of five
11 elsewhere
Hello!
}
var i = 0;
function WriteLnIntRange(value) {
{var $temp1 = value;
if (($temp1>=(-2))&&($temp1<=(-1))) {
WriteLn("negative") }
else if ($temp1==0) {
WriteLn("zero") }
else if ($temp1==5) {
WriteLn("multiple of five") }
else if ($temp1==10) {
WriteLn("multiple of five") }
else if (($temp1>=1)&&($temp1<=4)) {
WriteLn("between 1 and 9 but 5") }
else if (($temp1>=6)&&($temp1<=9)) {
WriteLn("between 1 and 9 but 5") }
else {
WriteLn("elsewhere") }
}
};
for(i=-3;i<=11;i++) {
WriteLn((i.toString()+" "));
WriteLnIntRange(i);
}
{var $temp2 = "Hello";
if (($temp2>="Bonjour")&&($temp2<="Icare")) {
WriteLn("Hello!") }
else if (($temp2>="Alpha")&&($temp2<="Omega")) {
WriteLn("oopsie!") }
else {
WriteLn("oopsie!") }
}