math.min
From ComputerCraft
Jump to: navigation, search
math.min Function | |
---|---|
Syntax math.min(
| |
Returns | number |
API | math |
Source | Lua (source) |
Return the smallest of all the numbers given.
|
|||
Read as many lines as the user inputs, and return the smallest value that they wrote. | |||
Code | local max = math.huge
while true do
local l = read()
if tonumber(l) then
max = math.min(max, tonumber(l))
else
break
end
end
print(max)
|
||
Output | The line the user wrote with the smallest value, or inf if they wrote no lines. |
Retrieved from ‘https://wiki.computercraft.cc/index.php?title=Math.min&oldid=3395’