PICO-8 Wiki
Explore
Main Page
Discuss
All Pages
Community
Interactive Maps
Recent Blog Posts
Popular pages
Most visited articles
Spr
Splore
P8SCII
Fget
Sspr
Pal
Line
Pico-8 tutorials
Useful Pico-8 code
Community
Recent blog posts
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
PICO-8 Wiki
244
pages
Explore
Main Page
Discuss
All Pages
Community
Interactive Maps
Recent Blog Posts
Popular pages
Most visited articles
Spr
Splore
P8SCII
Fget
Sspr
Pal
Line
Pico-8 tutorials
Useful Pico-8 code
Community
Recent blog posts
Editing
Max
Back to page
Edit
Edit source
View history
Talk (0)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{ApiReference |name=max |shortdesc=Returns the maximum of two numbers. |first||The first number. |second|optional|The second number. (default 0) }} == Examples == <syntaxhighlight lang="lua"> 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 </syntaxhighlight> == See also == * [[Math]] * [[Min|<code>min()</code>]] * [[Mid|<code>mid()</code>]] [[Category:Reference]] [[Category:API]] [[Category:Lua]]
Summary:
Please note that all contributions to the PICO-8 Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:ApiReference
(
view source
)
Follow on IG
TikTok
Join Fan Lab