RosettaCodeData/Task/Integer-comparison/Ruby/integer-comparison-2.rb

9 lines
231 B
Ruby

a = (print "enter a value for a: "; gets).to_i
b = (print "enter a value for b: "; gets).to_i
case a <=> b
when -1; puts "#{a} is less than #{b}"
when 0; puts "#{a} is equal to #{b}"
when +1; puts "#{a} is greater than #{b}"
end