CASE

CASE V

PRESENTS A GROUP OF STATEMENTS TO BE EXECUTED IF THE EXPRESSION EVALUATED BY "SELECT" MATCHES THE VALUE V

  • Type: Directive
  • Parameter: 1
  • Group: Structures

ACTION

The statement is a part of the structure SELECT/CASE/END_SELECT, and is used to define a statement or a group of statements to be executed if the result of the evaluation of expression E (in "SELECT E") matches the value V.

The statement or the group of statements to be executed is defined like that: it begins after CASE V and finishes at the following CASE, or at the END_SELECT, if the CASE V is the last one in the list.

V is a numerical value: it is not an expression.

Remark: in a structure SELECT/CASE/END_SELECT, the order of CASEs is not significant, but two CASEs cannot have the same value.

SYNTAX: CASE V

  • V: numerical expression.

USE

  • CASE is used, associated with SELECT and END_SELECT, to define one statement or a block of statements to be executed if the value of the evaluated expression of SELECT matches the value V.

ERROR

  • If V is not a correct numerical value.
  • If V is equal to the value of another CASE of the same structure SELECT/END_SELECT.

EXAMPLE

dim v

v=5

select v

case 1:print "V is 1"

case 5:print "V is 5"

case 8:print "V is 8"

end_select

SEE ALSO

SELECT

END_SELECT