inc

Summary

Increments either the input or the first parameter with one.

Usage

input|inc( value )

Parameters

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

Returns

Number (input/parameter incremented with one).

Description

This operator increments 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 increment the value of a variable (please refer to the last example).

Examples

Example 1

{255|inc}

or

{inc( 255 )}

 

The following output will be produced: "256".

Example 2

{def $i=255}
{set $i=inc( $i )}
{$i}

The following output will be produced: "256".

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.