GlowMUCK Logo

Home Documentation MUF Docs GlowMUF Downloads Bug Tracking Support Requests Feature Requests

lib-case

Anyone familiar with "select...case" statements should be relatively at home with lib-case. Put the data item to be check at the top of the stack and then 'case'. Follow with a possible test for the data item followed by a when ... end (effectively structured like a if...then). Continue doing this for each possible case and if desired, include the optional default...end case (code to be executed if no matches are found). finish up the section with an 'endcase'.

<data> case
    <test> when <effect> end
    <test> when <effect> end
    <test> when <effect> end
    <test> when <effect> end
    default <otherwise> end
endcase

A "real world" example:
command @ case
    "firstcmd" strcmp not when handle-firstcmd end
    "secondcmd" strcmp not when handle-secondcmd end
    default handle-invalidcmd end
endcase

lib-case / Revised 2004 September 23 14:39 (Thursday)
© 2004 Glowmuck Development Group

Valid XHTML 1.1! Valid CSS!