pow

.pow( n )

Returns this number, taken to the power of 'n'.

square = 7.pow( 2 )
cube   = 5.pow( 3 )

**

There is also a power operator, the **, which can be used as an alternative to 'pow'.

square = 7 ** 2
cube   = 5 ** 3

Advanced Example

Draws the powers of 2, from 0 to 12, as circles.

onEachFrame() do |delta|
    fill( :white )
    
    setColor( :green, 0.1 )
    12.times() do |i|
        size = 2.pow( i )
        
        fillCircle( 0, getScreenHeight(), size, true )
    end
end

See also

sqrt - square - cube