condition {case condition: statement [case condition: statement] ... [default: statement]}
The return value of the statement that corresponds to the first true condition or the default. Otherwise nil.
This statement is similar to the switch statement, except that it takes no arguments. It checks the truth value of each condition in turn. The first true condition encountered returns with the return value of the passed statement. If no condition is true, it returns the return value of the default statement, (or nil, if no default statement is given).
The words "case" and "default" and the symbols {, :, and } are unchanging syntactical elements.
Gamma> a = 5; 5 Gamma> b = 9; 9 Gamma> condition {case a == b: princ("Equal\n"); case a != b: princ("Unequal\n");} Unequal t Gamma>
Also see the example in switch.
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.