Concatenate:

#set($string1 = "con") #set($string2 = "cat") #set($string3 = $string1 + ' ' + $string2)

First string: $string1

Second string: $string2

If I can mention both strings, like this: $string1 $string2, then why should I concatenate only to get this: $string3 ????

Increment

I can simply set a numeric variable equal to itself + 1 OR I could use one of the items below:

Math

#set($score = "0")

A variable with "0" as its value: $score

To Integer: $_MathTool.toInteger($score)

Add 1: $_MathTool.add($score,1)

#set($ice = 4)

If ${_EscapeTool.dollar}ice is 4, then ${_EscapeTool.dollar}ice cubed is $_MathTool.pow($ice,3)

4 multiplied by 3 is $_MathTool.mul(4,3)

4 divided by 3 is $_MathTool.div(4,3)

4 minus 3 is $_MathTool.sub(4,3)

Modulus: 4 mod 3 is $_MathTool.mod(4,3)

A random number between 1 and 100: $_MathTool.random(1,100)

Summation: Sum of 8, 6, 7, 5, 3, 0 and 9 = $_MathTool.getTotal([8,6,7,5,3,0,9])

Maximum of 8, 6, 7, 5, 3, 0 and 9 = $_MathTool.max(8,6,7,5,3,0,9)

Minimum of 8, 6, 7, 5, 3, 0 and 9 = $_MathTool.min(8,6,7,5,3,0,9)

The average of 8, 6, 7, 5, 3, 0 and 9 = $_MathTool.getAverage([8,6,7,5,3,0,9])

The average of 8, 6, 7, 5, 3, 0 and 9 rounded to the nearest whole integer = $_MathTool.round($_MathTool.getAverage([8,6,7,5,3,0,9]))

The average of 8, 6, 7, 5, 3, 0 and 9 rounded to 2 decimal places = $_MathTool.roundTo(2,$_MathTool.getAverage([8,6,7,5,3,0,9]))