Reference floor()

floor()

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

floor() can also be used in shaders with p5.strands. The following example uses floor() to create banding effects on a shape.

Examples

Syntax

floor(n)

Parameters

n
Number: number to round down.

Returns

Integer: rounded down number.

Related References