Skip to the content
Documentation

inc

No ratings yet

Summary

Increments either the input or the first parameter with one.

Usage

input|inc( value )

Parameters

Name Type Description Required
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".

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

Comments

Add a comment

Comments are read by a moderator before they appear.