Smart pascal source code
type
TEnum = (enOne, enTwo, enThree);
procedure WriteLnBool(msg: string; b: Boolean);
begin
Writeln(msg);
if b then
Writeln('True')
else
Writeln('False');
end;
{ main.pas }
Begin
WriteLnBool('1 = 1 is ', enOne = enOne);
WriteLnBool('1 <> 1 is ', enOne <> enOne);
WriteLnBool('1 = 2 is ', enOne = enTwo);
WriteLnBool('1 <> 2 is ', enOne <> enTwo);
WriteLnBool('1 in [2, 3] is ', enOne in [enTwo, enThree]);
WriteLnBool('1 not in [2, 3] is ', enOne not in [enTwo, enThree]);
WriteLnBool('2 in [2, 3] is ', enTwo in [enTwo, enThree]);
WriteLnBool('2 not in [2, 3] is ', enTwo not in [enTwo, enThree]);
{ <<< CONSOLE OUTPUTS >>>
1 = 1 is True
1 <> 1 is False
1 = 2 is False
1 <> 2 is True
1 in [2, 3] is False
1 not in [2, 3] is True
2 in [2, 3] is True
2 not in [2, 3] is False
}
WriteLnBool("1 = 1 is ",(0==0));
WriteLnBool("1 <> 1 is ",(0!=0));
WriteLnBool("1 = 2 is ",(1==0));
WriteLnBool("1 <> 2 is ",(1!=0));
WriteLnBool("1 in [2, 3] is ",(1<<0&6)!=0);
WriteLnBool("1 not in [2, 3] is ",!((1<<0&6)!=0));
WriteLnBool("2 in [2, 3] is ",(1<<1&6)!=0);
WriteLnBool("2 not in [2, 3] is ",!((1<<1&6)!=0));
function WriteLnBool(msg, b) {
WriteLn(msg);
if (b) {
WriteLn("True");
} else {
WriteLn("False");
}
};