A
Anthony Ob
I want to know, what code i use, if someone doesnt enter the correct
word/phrase, lets say (using my script). I want to know how if they
enter something wrong like at the begining if they enter K_sdg_C, and
how do i put something like pick either bleh or bleh
print "For Kelvin to Celcius type in K_to_C, for Celcius to Kelvins type
in C_to_K, which one do you wanna do?"
choice = gets.chomp
if choice == "K_to_C";
print "Type in Kelvin Tempurature."
kelvin = gets.chomp
kelvin = kelvin.to_f
puts (kelvin - 273)
end
if choice == "C_to_K";
print "Type in Celcius Tempurature."
Celcius = gets.chomp.to_i
celcius = celcius.to_f
puts (Celcius + 273)
end
word/phrase, lets say (using my script). I want to know how if they
enter something wrong like at the begining if they enter K_sdg_C, and
how do i put something like pick either bleh or bleh
print "For Kelvin to Celcius type in K_to_C, for Celcius to Kelvins type
in C_to_K, which one do you wanna do?"
choice = gets.chomp
if choice == "K_to_C";
print "Type in Kelvin Tempurature."
kelvin = gets.chomp
kelvin = kelvin.to_f
puts (kelvin - 273)
end
if choice == "C_to_K";
print "Type in Celcius Tempurature."
Celcius = gets.chomp.to_i
celcius = celcius.to_f
puts (Celcius + 273)
end