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

when

when( 
g_condition 
g_expr1 ... 
) 
=> g_result / nil 

Description

Evaluates a condition. If the result is non-nil, evaluates the sequence of expressions and returns the value of the last expression. This is a syntax form.

If the result of evaluating g_condition is nil, when returns nil.

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 non-nil.

nil

If the g_condition expression evaluates to nil.

Examples

x = -123
when( x < 0
println("x is negative")
-x)
=> 123   ;Prints "x is negative" as side effect.
when( x >= 0
println("x is positive")
x)
=> nil

Related Topics

Flow Control Functions

cond

if

unless


Return to top
 ⠀
X