在else
用户没有输入1
或2
的地方,脚本应该在显示错误消息后重新开始。我怎样才能做到这一点?
puts "Do you want to calculate celcius to fahrenheit (1) or fahrenheit to celcius(2)"
input = gets
if input == 1
puts "Please enter degrees in Celcius."
celcius = gets
fahrenheit = (celcius.to_i * 9 / 5) + 32
print "The result is "
print fahrenheit
puts "."
elseif input == 2
puts "Please enter degrees in Fahrenheit."
fahrenheit = gets
celcius = (fahrenheit.to_i / 9 * 5) - 32
print "The result is:"
print celcius
puts "."
else
puts "Please enter option 1 or 2"
end