Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.

BeastNode

CommandHelper/Staged/API/add

From EngineHub.org Wiki
Jump to: navigation, search



Vital Info

Name add
Returns mixed
Usages var1, [var2...]
Throws CastException
Since 3.0.1
Restricted
No
Optimizations CONSTANT_OFFLINE
OPTIMIZE_DYNAMIC
CACHE_RETURN

Description

Adds all the arguments together, and returns either a double or an integer. Operator syntax is also supported: @a + @b

Usages

add(var1, [var2...])

Examples (How do these work?)

Example 1

Demonstrates adding two numbers together

Given the following code:

1   msg(add(2, 2))


The output would be:

4

Example 2

Demonstrates adding two numbers together, using the operator syntax

Given the following code:

1   2 + 2


The output would be:

:4

Example 3

Demonstrates grouping with parenthesis

Given the following code:

1   (2 + 5) * 2


The output would be:

:14

Example 4

Demonstrates order of operations

Given the following code:

1   2 + 5 * 2


The output would be:

:12


See Also

subtract, multiply, divide



Navigation menu