Jump to content

Rebol Programming/switch

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
SWITCH value cases /default case /all 

DESCRIPTION:

[edit | edit source]

Selects a choice and evaluates the block that follows it.

SWITCH is a native value.

ARGUMENTS

[edit | edit source]
  • value -- Value to search for. (Type: any)
  • cases -- Block of cases to search. (Type: block)

REFINEMENTS

[edit | edit source]
  • /default
    • case -- Default case if no others are found. (Type: any)
  • /all -- Evaluates all matches (not just first one).

SOURCE CODE

[edit | edit source]
switch: native[
    {Selects a choice and evaluates the block that follows it.} 
    value "Value to search for." 
    cases [block!] "Block of cases to search." 
    /default case "Default case if no others are found." 
    /all "Evaluates all matches (not just first one)."
]