MIN
min( a, b )
min | "minimum" |
a | a number |
b | a number |
The min( a, b ) function is used to compare two numbers a
and b
, and it returns the lesser of the two numbers.
For example, if we call min(4, 18)
, the function will compare the two arguments and determine that 4
is the lesser value. Therefore, it will return 4
.
lesser = min(4,18)
print(lesser) --prints 4
Similarly, if we call min(-5, 1)
, the function will return -5
since -5
is less than 1
.
lesser = min(1,-5)
print(greater) --prints -5
Images in this Guide by NerdyTeachers is licensed under CC BY-SA 4.0

702
11 Apr 2023