unless
unless(g_conditiong_expr1... ) =>g_result/nil
Description
Evaluates a condition. If the result is true (non-nil), it returns nil; otherwise evaluates the body expressions in sequence and returns the value of the last expression. This is a syntax form.
The semantics of this function can be read literally as "unless the condition is true, evaluate the body expressions in sequence".
Arguments
Value Returned
|
Value of the last expression of the sequence g_expr1 if g_condition evaluates to |
|
Examples
x = -123
unless( x >= 0 println("x is negative") -x)
=> 123 ;Prints "x is negative" as side effect.
unless( x < 0 println("x is positive") x)
=> nil
Related Topics
Return to top