BlobbieScript - Expressions - Switch

The 'switch' construct enables easy selection of a matching option from a list of candidates.

    Example:

switch( @type ) { case 'sword' case 'rapier' case 'scimitar' { %echoTo( "You have a sword!", @self ); break; } case 'dagger' { %echoTo( "You have a dagger!", @self ); break; } default { %echoTo( "You have something interesting!", @self ) } } endswitch

An interesting thing about switch statements is that without a break, the code for any following case statements will also be evaluated. This is why in the first example we can list multiple types of sword and still get the desired output.