Hi all,
Does J have a conditional control structure such that 1 of N options, with a
way to specify a default if none of the conditions are met?
In matlab, for example:
if (x==4)
disp("4")
elseif (x==5)
disp("5")
else
disp('other')
endif
One could also use a switch/ case/ otherwise construct.
This construct is especially important in defensive programming, and is way
better than just have a chain of if statements, since it guarantees that only
one of the conditional blocks is executed.
Thanks!
---
W. Webb Sprague
Forecast Analyst
Office of Financial Management, Forecast Division
GA Bldg., 3rd Floor, 318-K
PO Box 43113
Olympia, WA 98504-3113
Tel: 360-902-0634
Fax: 360-725-5174
[email protected]
http://www.ofm.wa.gov/pop/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm