Home   Manual   Type Index   Symbol Index   Topics Index

std::cond

a multiway conditional expression or statement

Parameters

args (zero or more arguments)

a sequence of conditions and statement sequences

Description

The conditions are evaluated one after the other until a condition evaluates to true. If a condition evaluates to true its corresponding statement-sequence is executed and no more conditions are considered.

If there is an odd number of arguments the last argument specifies a default statement-sequence that is executed if no condition evaluates to true.

See also

std::if   classic if; can be used as a function or a procedure
std::case   multi-branch conditional

Topics

Branches

Example

cond
  -> chr >= 'a' && chr <= 'z':
    writeln "lower case character"
  -> chr >= 'A' && chr <= 'Z':
    writeln "upper case character"
  -> chr == '_':
    writeln "underscore"
  -> chr >= '0' && chr <= '9':
    writeln "digit"
  -> true:
    writeln "neither character nor digit nor underscore"