Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

dec

Summary

Returns input or parameter decremented by one.

Usage

input|dec( value )

Parameters

NameTypeDescriptionRequired
value number The value that should be decremented. Only if the input parameter is omitted.

Returns

input/parameter decremented with one.

Description

This operator decrements either the input or the "value" parameter with one and returns the result as an integer. If both are provided, it is the "value" parameter that will be used. Please note that this operator can not be used directly to decrement the value of a variable (please refer to the last example).

Examples

Example 1

{256|dec}

or

{dec( 256 )}

The following output will be produced: 255.

Example 2

{200|dec( 250 )}

The following output will be produced: 249.

Example 3

{def $i=256}
{set $i=dec( $i )}
{$i}

This example demonstrates how the value of a variable can be decremented using the "set" and the "dec" operators. The following output will be produced: "255".

Balazs Halasy (05/02/2004 10:46 am)

Balazs Halasy (04/05/2005 2:12 pm)


Comments

There are no comments.