case. value do.
fcase. value do.
Execute if value matches selector
Fall through or execute if value matches selector
Valid only inside an explicit definition.
Execute one (or one sequence) of a list of blocks which corresponds to the value of y.
The block following the select. is evaluated. Then the blocks following each subsequent case./fcase. are evaluated. When a case is found that matches the result of the select. block, the block after its do. is executed.
After the block has been executed, control passes to the end. statement corresponding to the select unless the next case is fcase (meaing fallthrough case). In that case, execution continues with the block for the fcase..
select_trial=: 3 : 0 select. y fcase. 'A' do. case. 'a' do. smoutput 'select a' fcase. 'B' do. case. 'b' do. smoutput 'select b' case. do. NB. optional catch-all case smoutput 'none of these' end. ) select_trial 'a' select a select_trial 'A' select a select_trial 'b' select b select_trial 'B' select b select_trial 'C' none of these select_trial 99 none of these
1. The select. block is terminated by the first case, not by a do..
2. The block following each case./fcase. is not terminated by end. .
3. If the value is omitted, the case matches any selector.
4. value may be a list of boxed values; the case is executed if the selector matches any of them. If the selector or value is unboxed, it is first boxed before being tested. Formally, the test is selector e.&boxifopen value where boxifopen=:<^:(0&(>: L.))