To find the minimum of two numbers in Ruby, you can use the min method.
In this example,
a
and b
.min
method to find the minimum of a
and b
.# Minimum of Two Numbers
a = 10
b = 15
min_val = [a, b].min
puts "Minimum of #{a} and #{b} is: #{min_val}"
Minimum of 10 and 15 is: 10
In this tutorial, we learned How to find the Minimum of Two Numbers in Ruby language with well detailed examples.