HomeManualTopicsTypesSymbols

std::if_not

can be used as a function or a procedure

Parameters

condition
true or false
then_part
the function to be evaluated if the condition is not true
else_part
the function to be evaluated if the condition is true

Results

None

Description

The "then-part"- and "else-part" functions can return any number of results (including none). But both should return the same number of results.

if_not is usually used with a simple then-part and a complex else-part.

Example

# "if_not" as a procedure $x 5 if_not x > 3: println! "x is not larger than 3" : println! "x is larger than 3"

Output

x is larger than 3

Example

# "if_not" as a function $x 5 println! if_not x > 3 -> "x is not larger than 3" -> "x is larger than 3"

Output

x is larger than 3

Topic

Branches

See also

std::if classic if; can be used as a function or a procedure
std::cond a multiway conditional expression or statement
std::case a multiway conditional expression or statement
std::and "short cut" and-operation
std::or "short cut" or- operation
std::default_value returns the first argument if it is defined or else the second argument

Implemented by

std_types::false evaluates the then-part and returns its result(s)
std_types::true evaluates the else-part and returns its result(s)