Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

unless

unless( 
g_condition 
g_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

g_condition

Any SKILL expression.

g_expr1

Any SKILL expression.

Value Returned

g_result

Value of the last expression of the sequence g_expr1 if g_condition evaluates to nil.

nil

If g_condition evaluates to non-nil.

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

Flow Control Functions

cond

if

when


Return to top
 ⠀
X