Reference ceil()

ceil()

Calculates the closest integer value that is greater than or equal to a number.

For example, calling ceil(9.03) and ceil(9.97) both return the value 10.

ceil() can also be used in shaders with p5.strands. The following example uses ceil() to create a stepped color effect on a shape.

Examples

Syntax

ceil(n)

Parameters

n
Number: number to round up.

Returns

Integer: rounded up number.

Related References