我写了这段代码,但它不工作。我真的很感激帮助:
puts "Welcome to my unit conversion calculator. This calculator can convert
between Centimeters and Inches. If you could like to convert Centimeters to Inches,
write: in. If you would like to convert Inches to centimeters, write: cm."
unit = gets
puts " how many of your unit would you like to convert"
a = 0.39370079
b = 2.54
unit_number = gets.to_f
if unit = cm
(unit_number * a)
else unit = in
(unit_number * b)
end