ObjectScript Reference
$CASE


$CASE(target,case:value,case:value,...,:default)
A literal or expression the value of which is to be matched against cases.  
A literal or expression the value of which is to be matched with the results of the evaluation of 

The value to be returned upon a successful match of the corresponding 

Start ; Raise an integer to a randomlyselected power. SET exp=$RANDOM(6) SET num=4 DO $CASE(exp,0:NoMul(),2:Square(num),3:Cube(num),:Exponent(num,exp)) WRITE !,num," ",result,! RETURN Square(n) SET result=n*n SET result="Squared = "_result RETURN Cube(n) SET result=n*n*n SET result="Cubed = "_result RETURN Exponent(n,x) SET result=n FOR i=1:1:x1 { SET result=result*n } SET result="exponent "_x_" = "_result RETURN NoMul() SET result="multiply by zero" RETURN
Content for this page loaded from RCOS_fcase.xml (file updated 20180920 03:16:36)
