Mega Code Archive

 
Categories / Ruby / Development
 

You dont need to use $_ with gets - you can assign the text it reads to any variable

print "Please enter the temperature: " temperature = gets $_ = temperature chomp temperature = $_ puts "The temperature is #{temperature}."