PICO-8 Wiki
(second arg defaults to 0)
(→‎Examples: syntax highlighting)
Line 7: Line 7:
   
 
== Examples ==
 
== Examples ==
  +
<syntaxhighlight lang="lua">
<pre>
 
 
print(max(40, 20)) -- 40
 
print(max(40, 20)) -- 40
   
Line 17: Line 17:
   
 
print(max(-5)) -- 0
 
print(max(-5)) -- 0
  +
</syntaxhighlight>
</pre>
 
   
 
== See also ==
 
== See also ==

Revision as of 02:45, 13 February 2018

max( first, [second] )
Returns the maximum of two numbers.
first
The first number.

second
The second number. (default 0)

Examples

print(max(40, 20))    -- 40

print(max(2.7, -3.5)) -- 2.7

print(max(8, 8))      -- 8

print(max(5))         -- 5

print(max(-5))        -- 0

See also