ldmud-3.2.9/doc/
ldmud-3.2.9/doc/efun/
ldmud-3.2.9/mud/
ldmud-3.2.9/mud/heaven7/
ldmud-3.2.9/mud/heaven7/lib/
ldmud-3.2.9/mud/lp-245/
ldmud-3.2.9/mud/lp-245/banish/
ldmud-3.2.9/mud/lp-245/doc/
ldmud-3.2.9/mud/lp-245/doc/examples/
ldmud-3.2.9/mud/lp-245/doc/sefun/
ldmud-3.2.9/mud/lp-245/log/
ldmud-3.2.9/mud/lp-245/obj/Go/
ldmud-3.2.9/mud/lp-245/players/lars/
ldmud-3.2.9/mud/lp-245/room/death/
ldmud-3.2.9/mud/lp-245/room/maze1/
ldmud-3.2.9/mud/lp-245/room/sub/
ldmud-3.2.9/mud/lp-245/secure/
ldmud-3.2.9/mud/morgengrauen/
ldmud-3.2.9/mud/morgengrauen/lib/
ldmud-3.2.9/mud/sticklib/
ldmud-3.2.9/mud/sticklib/src/
ldmud-3.2.9/mudlib/uni-crasher/
ldmud-3.2.9/pkg/
ldmud-3.2.9/pkg/debugger/
ldmud-3.2.9/pkg/diff/
ldmud-3.2.9/pkg/misc/
ldmud-3.2.9/src/autoconf/
ldmud-3.2.9/src/bugs/
ldmud-3.2.9/src/bugs/MudCompress/
ldmud-3.2.9/src/bugs/b-020916-files/
ldmud-3.2.9/src/bugs/doomdark/
ldmud-3.2.9/src/bugs/ferrycode/ferry/
ldmud-3.2.9/src/bugs/ferrycode/obj/
ldmud-3.2.9/src/bugs/psql/
ldmud-3.2.9/src/done/
ldmud-3.2.9/src/done/order_alist/
ldmud-3.2.9/src/done/order_alist/obj/
ldmud-3.2.9/src/done/order_alist/room/
ldmud-3.2.9/src/gcc/
ldmud-3.2.9/src/gcc/2.7.0/
ldmud-3.2.9/src/gcc/2.7.1/
ldmud-3.2.9/src/hosts/
ldmud-3.2.9/src/hosts/GnuWin32/
ldmud-3.2.9/src/hosts/amiga/NetIncl/
ldmud-3.2.9/src/hosts/amiga/NetIncl/netinet/
ldmud-3.2.9/src/hosts/amiga/NetIncl/sys/
ldmud-3.2.9/src/hosts/i386/
ldmud-3.2.9/src/hosts/msdos/byacc/
ldmud-3.2.9/src/hosts/msdos/doc/
ldmud-3.2.9/src/hosts/os2/
ldmud-3.2.9/src/hosts/win32/
ldmud-3.2.9/src/util/
ldmud-3.2.9/src/util/erq/
ldmud-3.2.9/src/util/indent/hosts/next/
ldmud-3.2.9/src/util/xerq/
ldmud-3.2.9/src/util/xerq/lpc/
ldmud-3.2.9/src/util/xerq/lpc/www/
NAME
        switch

SYNTAX
        switch (expr) statement;

DESCRIPTION
        Branch to the case label in statement that matches expr.
        If no matching case label is found (by value or by type),
        branch to the default label in statement.

        A case label has the form

                case expr_n :

        where expr_n must be constant, or the form

                case expr_n1 .. expr_n2 :

        where expr_n1 and expr_n2 must be numeric constants and
        expr_n1 < expr_n2.

        Either all case labels have to be strings or all have to be
        numeric. Only 0 is special: it is allowed in a switch
        statement where all other labels are strings.

        A default label has the form

                default :

        The default label defaults to the end of statement if not
        given explicitly.

        Whenever a 'break' statement is executed inside 'statement' a
        branch to the end of the switch statement is performed.

EXAMPLE
        Typical usage:

        switch(random(100)) {
          case 0 .. 22 : write("Nothing happens"); break;
          case 23 .. 27 :
            write("You are surrounded by a golden glow");
            this_player()->heal_self(random(3));
            break;
          case 28 .. 32 :
            write("The water was poisoned!\n");
            this_player()->add_exp(this_player()->hit_player(random(4)));
            break;
          case 33 : write("You hear a voice whispering: "+random_hint());
          /* fall through */
          case 34 :
            write("While you didn't paid attention, a water demon snatches\n"
                  "a coin out of your purse!\n");
            this_player()->add_money(-1);
            break;
          default : write "You hear some strange noises\n"; break;
          case 42 : return;
          case 99 : write("It tastes good.\n";
        }

HISTORY
        LDMud 3.2.9/3.3 allowed to pass values of the wrong type to switch(),
          the driver would in that case use the default case. Before, values
          of the wrong type caused a runtime error.

SEE ALSO
        for(LPC), foreach(LPC), do-while(LPC), if(LPC), while(LPC)