Home   Manual   Type Index   Symbol Index   Topics Index

std::case

multi-branch conditional

Parameters

expr

the expression to check

values_and_bodies (zero or more arguments)

an alternating sequence of case-values and statement sequences

Description

Depending on the value of expr the statement-sequence associated with the matching case is executed.

The last argument can be a single statement-sequence without a preceding value. It is executed if no case matches the expression.

See also

std::if   classic if; can be used as a function or a procedure
std::cond   a multiway conditional expression or statement

Topics

Branches

Example

case chr
  'a' .. 'z':
    writeln "lower case character"
  'A' .. 'Z':
    writeln "upper case character"
  '_':
    writeln "underscore"
  '0' .. '9':
    writeln "digit"
  :
    writeln "neither character nor digit nor underscore"