if
function, since version 1.0.0
categories: conditionals
if(cond, t, f)
returns t
if cond
is true, otherwise returns f
parameters
- cond: boolean - condition
- t: any - value to be returned if
cond
is true - f: any - value to be returned if
cond
is false - note: parameters
t
andf
must have the same type
return type:
any, the same type of parameter t
and f
example
if(product.quantity == 10, 'equal to 10', 'not 10')