I am trying to make a simple temperature converter, and I want to ask
for F temperature (numerical value)
what command do I use?
I am trying to make a simple temperature converter, and I want to ask
for F temperature (numerical value)
what command do I use?
Hi –
On Fri, 25 Sep 2009, Fred I. wrote:
I am trying to make a simple temperature converter, and I want to ask
for F temperature (numerical value)what command do I use?
The bread-and-butter way to get keyboard input is with gets:
print "Enter a number: "
line = gets
and then, since line is a string:
num = line.to_i
You can get fancier with error-checking, etc., but that’s the basic
idea.
David
Hi,
Am Freitag, 25. Sep 2009, 11:12:37 +0900 schrieb David A. Black:
You can get fancier with error-checking, etc., but that’s the basic
idea.
This does the error checking:
num = Integer line
Bertram
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs