math.pow

From ComputerCraft
Jump to: navigation, search

math.pow
Function
Syntax
math.pow()
Returns number
API math
Source Lua (source)

Return x raised to the yth power. This is equivalent to the operator ^.

ExampleExamplePrint the n-th power of two
Read a line from the user, then print two raised to that number.
Code
print(math.pow(2, tonumber(read())))
Output Depends on what the user wrote. For instance, if they were to enter 5, the value printed would be 32.