[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
in                       Special Operator for Testing Set Membership

 <expr> in <set>

    This statement tests to see if a value is a member of a set. If <expr>
    yields a value that is currently a member of <set>, then this
    statement returns TRUE; otherwise, it returns FALSE.

             <expr>   Any ordinal expression (Integer, Char, Boolean,
                      enumerated).

              <set>   Any set (constant or variable). Must be of the same
                      ordinal type as <expr>.

  -------------------------------- Example ---------------------------------

           if Num in [2,3,5,7,11,13,19]
             then Write('is prime')
             else Writeln('is not prime');

           Write('Do you wish to exit the program? (Y/N) ');
           repeat
             Read(Kbd,Ch);
             Ch := Upcase(Ch)
           until Ch in ['Y','N'];

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