Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: reading files
7stud 7stud
10/10/2007 3:46:00 AM
smc smc wrote:
> this is just a very basic example but how would you make it so that a
> user
> may put their name (or some other info) into a file and then the program
> reads it and sets it as a variable?
>
> so like:
>
> def say_hi(who)
> result = "hello " + who
> return result
> end
>
> puts say_hi(person_name)
data.txt
-------
Sally Smith
123-4567
sally@yahoo.com
data = IO.readlines("data.txt")
puts data[0].strip
puts data[1].strip
puts data[2].strip
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: reading files
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