Smaller of two values
Compare two values and return the smaller one.
min
Simple example
Start3 · 7
Result3
function main()
println(min(3, 7))
end
main()
3
Advertisements
Everyday examples
Two buses charge 8 and 5 for the same trip. Which fare is cheaper?
Start8 · 5
Result5
function main()
println(min(8, 5))
end
main()
5
A child wants 5 stickers. You have 3 left. How many can you give them?
Start5 · 3
Result3
function main()
println(min(5, 3))
end
main()
3
Two walks to school take 12 and 9 minutes. How long is the quicker walk?
Start12 · 9
Result9
function main()
println(min(12, 9))
end
main()
9
If both values are equal, the answer is that same value.