Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
FreeRide - How to Input Data
Bill Kiselewsky
3/22/2006 3:56:00 PM
Hi,
New to Ruby and using the FreeRIDE IDE. I tried to run the following
simple program but can't figure out how to enter data when the run stops
at the second line of code. what's the secret?
puts 'Hello there, and what\'s your name?'
name = gets.chomp
puts 'Your name is ' + name + '? What a lovely name!'
puts 'Pleased to meet you, ' + name + '. :)'
Thanks,
Bill Kiselewsky
--
Posted via
http://www.ruby-...
.
1 Answer
Bill Kiselewsky
3/22/2006 8:08:00 PM
0
Forgot to mention the platform being Windows XP.
Well, after hours of messing around I found that outside of FreeRIDE I
could execute interactively by double clicking the *.rb file in
explorer. This opened a c:\ruby\bin\ruby.ex window which allowed me to
execute an interactive Ruby program.
Program:
puts "Please enter your first name ..."
fname = gets.chomp
puts "Please enter your middle name ..."
mname = gets.chomp
puts "Please enter your last name ..."
lname = gets.chomp
chars = fname.length + mname.length + lname.length
puts fname + ' ' + mname + ' ' + lname + ' there are ' + chars.to_s + '
characters in your full name!'
gets
Interactive:
Please enter your first name ...
William
Please enter your middle name ...
Anthony
Please enter your last name ...
Kiselewsky
William Anthony Kiselewsky there are 24 characters in your full name!
Take care,
Bill K.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
FreeRide - How to Input Data
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password