switch
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | switch [2006/08/29 16:08] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | #$EPIC: switch.txt, | ||
+ | ======Synopsis: | ||
+ | __switch__ (< | ||
+ | |||
+ | ======Description: | ||
+ | __SWITCH__ is similar to C's switch statement. | ||
+ | alternatives to a given " | ||
+ | possible values exist. | ||
+ | doesn' | ||
+ | |||
+ | Whitespace is not significant any any part of __SWITCH__. | ||
+ | appear anywhere, and multiple switches may appear on the same line | ||
+ | or on individual lines. | ||
+ | string comparisons. | ||
+ | needed (nor allowed), as everything is assumed to be a string, and | ||
+ | variables are expanded. | ||
+ | |||
+ | Breaks and "Fall through" | ||
+ | If you need to perform the same command in multiple switches, it must | ||
+ | be present in each switch' | ||
+ | |||
+ | ======Examples: | ||
+ | A simple switch that checks the value of an arbitrary input: | ||
+ | switch ( $0 ) { | ||
+ | ( foo ) { | ||
+ | <do action for " | ||
+ | } | ||
+ | ( bar ) ( blah ) { | ||
+ | <do action for " | ||
+ | } | ||
+ | ( * ) { | ||
+ | <do action for everything else> | ||
+ | } | ||
+ | } | ||
switch.txt · Last modified: 2006/08/29 16:08 by 127.0.0.1