helpers /  Math

Math

{{add}}

Returns the sum of two numbers.
Parameters: value int - The number to add to the expression. (Required)

Data:

value = 5 

Template:

{{add value 5}}

Renders to:

10

{{ceil}}

Returns the value rounded up to the nearest integer.
Parameters: none

Data:

value = 5.6 

Template:

{{ceil value}}

Renders to:

6

{{divide}}

Returns the division of two numbers.
Parameters: value int - The number to divide the expression. (Required)

Data:

value = 5 

Template:

{{divide value 5}}

Renders to:

1

{{floor}}

Returns the value rounded down to the nearest integer.
Parameters: none

Data:

value = 5.6 

Template:

{{floor value}}

Renders to:

5

{{multiply}}

Returns the multiplication of two numbers.
Parameters: value int - The number to multiply the expression. (Required)

Data:

value = 5 

Template:

{{multiply value 5}}

Renders to:

25

{{round}}

Returns the value rounded to the nearest integer.
Parameters: none

Data:

value = 5.69 

Template:

{{round value}}

Renders to:

6

{{subtract}}

Returns the difference of two numbers. Opposite of add
Parameters: value int - The number to subtract from the expression. (Required)_

Data:

value = 5 

Template:

{{subtract value 5}}

Renders to:

0

{{sum}}

Returns the sum of multiple numbers. Similar to {{#add}} block helper but accepts multiple arguments.
Parameters: none

Data:

value = {
  a: 1,
  b: 2,
  c: 3 
}

Template:

{{sum value.a value.b value.c}}

Renders to:

6

See the template for this page →

Find an error? Let us know →