This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

max()

Examples
int a = max(5, 9);            // Sets 'a' to 9
int b = max(-4, -12);         // Sets 'b' to -4
float c = max(12.3, 230.24);  // Sets 'c' to 230.24

int[] values = { 9, -4, 362, 21 };  // Create an array of ints
int d = max(values);                // Sets 'd' to 362
Description Determines the largest value in a sequence of numbers, and then returns that value. max() accepts either two or three float or int values as parameters, or an array of any length.
Syntax
max(a, b)
max(a, b, c)
max(list)
Parameters
a float, or int: first number to compare
b float, or int: second number to compare
c float, or int: third number to compare
list float[], or int[]: array of numbers to compare
Returnsint or float
Relatedmin()
Updated on January 1, 2021 03:38:06am EST