Switch

From TinyMUX
Jump to navigation Jump to search

Switch

The term switch has multiple meanings. It can indicate that an optional parameter is passed to a command to modify the command behavior, refer to the @switch command itself, or to the switch() softcode function.

In the first sense, many commands allow optional parameters. The syntax is <command>/<switch name>. The switch name can often be abbreviated to one or more letters as long as the abbreviation is unique across all possible switch names for the given command. A couple of examples of switches for commands are @dig/teleport and get/quiet. The @switch command also takes optional parameters such as /all or /first.

The @switch command is used to execute one or more optional sequences of commands based on an input argument. This behavior is similar to a case statement in the C and other programming languages. Finally, switch() performs a similar behavior to @switch but is used within functional blocks of softcode rather than a command based approach. See the @switch and switch() topics for additional information on usage.