Compare enumerations | in keyword



Compare enumerations
Pas2JS 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 }