ult()
Published Oct 15, 2023
Contribute to Docs
The ult()
method takes two integers as arguments and compares their absolute values. The method will return true
if and only if the first value is less than the second value. Otherwise, it will return false
.
Syntax
The syntax of ult()
is as follows:
math.ult(int1, int2)
Where int1
and int2
are the integer arguments to be compared.
Examples
The following examples illustrate the behavior of ult()
:
print(math.ult(5,6))print(math.ult(5,-6)) --lua will convert '-6' to the unsigned integer '6' when performing this callprint(math.ult(5,5))print(math.ult(5,4))
This results in the output:
truetruefalsefalse
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Lua on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Lua
Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.Beginner Friendly4 hours