case

case

Stack
Stack Position Description
Stack(In) top value
Stack(Out) top -

This statement starts a construction with the form:

case
  S1:       S11 S12 ... S1k
  S2:       S21 S22 ... S2l
  . . .
  Sn:       Sn1 Sn2 ... Snm
  default: Sd1 Sd2 ...
endCase

The evaluation conforms exactly with the execution of the equivalent statement sequence:

Var(tmp)
-> tmp  // stack top value
tmp S1 =  // test 1
if { S11 S12 ... S1k
}
else { tmp S2 =  // Test 2
       if { S21 S22 ... S2l
       }
       . . .
                      else { tmp Sn =  // Test n
                             if { Sn1 Sn2 ... Snm
                            }
                            else { // default
                                   Sd1 Sd2 ...
                             }
                     }
       . . .
}

Statements have to stand for S1 ... Sn, which bring a value into the stack (constants or variables). InstantView® compares these values with the value case finds in the stack top (= if). As soon as the test conditions are fulfilled for the first time - the i-th test returns TRUE - all connected statements Si1, Si2, ... are executed. If the result of all tests (test1, ..., testn) is FALSE, the sequence Sd1, Sd2 ... will be executed, no matter in which position the default branch has been indicated. The default branch can also be missing. Multiple conditions (case label) can be in front of a case branch.

Information case constructions can have a nesting depth up to 5.

  Example