choose

Summary

Returns one of the parameters (pinpointed by the input parameter).

Usage

input|choose( value1 [, value2 [, ... ] ] )

Parameters

NameTypeDescriptionRequired
value1 any A variable/value of any kind. Yes.
value2 any Another variable/value of any kind. No.

Returns

One of the parameters.

Description

This operator returns one of the parameters. The input parameter must be an integer that pinpoints exactly which parameter that should be returned. If the input parameter is zero, the operator will return the first parameter. If the input parameter is one, the operator will return the second parameter, and so on. If the offset is wrong, the operator will return FALSE.

Examples

Example 1

{0|choose( 'apples', 'bananas', 'coconuts' )}

The following output will be produced: "apples".

Example 2

{2|choose( 'apples', 'bananas', 'coconuts' )}

The following output will be produced: "coconuts".

This document is based on eZ Publish Documentation. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License.