cond

Summary

Returns the value of the first clause who's condition is true.

Usage

cond( cond1, value1 [, cond2, value2 [, ... ] ] )

Parameters

NameTypeDescriptionRequired
cond1 boolean Match condition 1 yes
value1 mixed Return value for condition 1 yes
cond2 boolean Match condition 2 no
value2 mixed Return value for condition 2 no
...

Returns

Condition for first matching condotion

Description

Returns the value for the first condition set to true. If the first condition is false, the second id checked, etc. until a condition is true.

If there are an odd number of parameters, the last parameter will be returned if all conditions fail.

Examples

{cond( true(), "Linux", "FreeBSD" )}

Returns "Linux".

{cond( false(), "Linux", true(), "FreeBSD" )}

Returns "FreeBSD".

{cond( false(), "Linux", "FreeBSD" )}

Returns "FreeBSD".

Comments

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
       and
       choose
       cond
       eq
       false
       first_set
       ge
       gt
       le
       lt
       ne
       not
       null
       or
       true
    Mathematics
    Miscellaneous
    Strings
    URLs
    Variables
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
11:39:38 am
by Balazs Halasy

Last updated

23/02/2004
4:26:37 pm
by Kåre Køhler Høvik

Authors

Balazs Halasy
Kåre Køhler Høvik



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.