power

Returns the given number to the given power; the number x multiplied by itself n number of times.

Syntax:

power(x, n);


Argument Description
x The number to change.
n How many times to multiply x by itself.


Returns: Real


Description

This will return the value of a number multiplied by itself "n" number of times. For example, power(5,3) will multiply 5 by itself 3 times and return 125, which is the same as saying 5*5*5=125. Please note that the "x" value (the number to change) cannot be a negative value.


Example:

score += power(dmg, 3);

This will add the value of held in the variable "dmg" to the power of 3 to the score variable.


Back: Real Number Functions
Next: sqr
© Copyright YoYo Games Ltd. 2018 All Rights Reserved