AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
switch grammar
 
A statement that passes control to a subordinate case statement or possibly to an optional default statement. The Yoix interpreter makes the selection at runtime by comparing the value of the supplied expression to the enclosed case statement expressions using the === operator. Its usage description can be summarized as follows:
Statement:
	switch ( Expression ) Compound

Every enclosed case expression is evaluated the first time the switch statement is executed and the results are saved and used again every time the switch statement is executed. This is an important point that is worth emphasizing: the Yoix interpreter builds a jump table for a switch statement at runtime by evaluating and saving every enclosed case expression, so the performance of a switch statement improves dramatically after the first execution. When no case statement provides a match control passes to the optional default statement or to the end of the switch statement.
 
 Example:   Switch statement examples can be found in the documentation for break, case, default or regexp.
 
 See Also:   break, case, default, reference

 

Yoix is a registered trademark of AT&T Intellectual Property.