Difference between revisions of "TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK"

From 4Dimensions
Jump to: navigation, search
(Bot: Automated import of articles)
(No difference)

Revision as of 04:00, 26 January 2016

TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK

TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK

TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK

TRIG-SWITCH TRIGEDIT-SWITCH CASE DEFAULT BREAK


Usage: switch expression


switch %random.4%

case 1

emote sings a merry song about someone named Fulbert and Beatrice.

break

case 2

emote booms out loudly, 'Heigh Ho! Heigh Ho! It's home from work we go!'

break

case 3

emote tries to sing falsetto, but his voice doesn't agree.

break

default

sing

break

done


Switch evaluates an expression and looks for a match amongst the case

statements that follow. If none of the following case statements are a match,

and a default statement exists, the default statement is considered a match.

If a match is found, the commands that follow it, up until a break or done

command, are executed.

Break is used to terminate commands in a switch.

Case is used to begin a new conditional group in a switch block.

Default is similiar to case but matches any condition not met.

Done is used to terminate a while or switch block.


Example: {cRTSTAT 18{c0