Skip to content
drewmccluskey edited this page Jan 14, 2019 · 5 revisions

power

Returns given number x multiplied by itself n-times

Syntax:

power(x, n)
Argument Description
double x The number to multiply by itself
double n How many times to multiply x by itself

Returns: double

Description:

This function returns the number x multiplied by itself n-times. For example, power(5,2) will multiply 5 by itself 2 times and return 25, which is the same as 5*5 = 25.

Example:

double value;
value = power(5, 3);

This code sets value to 125.

Example 2:

double value;
value = power(-4, 2);

This code sets value to 16.

Example 3:

double value;
value = power(10, -2);

This code sets value to 0.01.

Back to number_functions

Clone this wiki locally