Read text from the command line, assigns that text to the predefined variable $_ : Command line « Development « Ruby






Read text from the command line, assigns that text to the predefined variable $_


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

 

Related examples in the same category