[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 IN                          Inclusion Operator                        pp 85


 Define:  Relational operator for Set types.

 Purpose: In determines if Argument is a member of Set.

 Notes:   The In operator is faster than using a series of relational
          expressions linked with the Or operator.


 ----------------------------------------------------------------------------


 Usage:
       CONST
          Letters : Set of Char = ['A'..'Z'];     { Upper case letters     }
          Menu    : Set of Char = ['1','2','3'];  { Menu choices           }
       VAR
          Choice  : Char;                         { Input variable         }

       BEGIN
          If 'A' In Letters then                  { Continue if in set     }
            Begin
            ReadLn (Choice);                      { Get console input      }
            If Choice in Menu                     { If valid choice..      }
               Then WriteLn ('OK')                { Choice is in Menu set  }
               Else WriteLn ('Bad');              { Choice not in Menu set }
            End;
       END.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson