Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>do case</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DO CASE


Syntax:     DO CASE
            CASE <condition>
               <statements>...
            [CASE <condition>]
               <statements>...
            [OTHERWISE]
               <statements>...
            ENDCASE

Purpose:    To execute one of several sets of statements depending on
            which of a set of associated conditions is true.

Options:    Otherwise: If none of the preceding CASE conditions are
            true, the statements following the OTHERWISE statement are
            executed up to the next ENDCASE statement.

Usage:      The DO CASE structure works by branching execution to the
            statements following the first CASE condition that evaluates
            to true (.T.).  Execution continues until the next CASE,
            OTHERWISE, or an ENDCASE is encountered.  At this point,
            control branches to the first command line following the
            ENDCASE.

            No nesting limits: Any number of commands including
            other structures (DO WHILE, DO CASE, IF, FOR) may be nested
            within a single DO CASE structure.  In addition, there is no
            fixed limit on the number of CASE statements that can be
            contained within a single DO CASE structure.

            Note that like all other control structures, only the first
            three characters of the END statement are significant.  END
            is also a reserved word and should not be used when naming
            memory variables.

Library:    CLIPPER.LIB


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

   * Display menu choices.
   @ 3, 25 PROMPT "First choice"
   @ 4, 25 PROMPT "Second choice"

   * Get menu key.
   MENU TO choice

   * Perform an action based on your menu choice.
   DO CASE
   CASE choice = 0
      RETURN
   CASE choice = 1
      DO One
   CASE choice = 2
      DO Two
   ENDCASE
   RETURN


See Also: BEGIN SEQUENCE DO DO WHILE IF IF()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson