cube

.cube()

Returns this number, taken to the power of 3. This is it's 'cube number'.

This is the same as multiplying this number, against it's self, twice.

// val is set to 27, which is 3 * 3 * 3
val = 3.cube()

Advanced Example

Draws lots of squares, in the centre of the screen. Their size is based on the cube of the loop index.

onEachFrame() do |delta|
    fill( :white )
    
    setColor( :red, 0.1 )
    
    10.times() do |i|
        size = i.cube()
        
        fillRect(
                getScreenWidth()/2, getScreenHeight()/2,
                size, size,
                true
        )
    end
end

See also

square - pow