From: Kev Date: 2007-03-19T19:40:06+09:00 Subject: Re: gets() makes my Ruby hang...? On Mar 18, 12:22 pm, "PythonUsr" wrote: > On Mar 17, 8:14 pm, Tom Rauchenwald wrote: > > > > > "PythonUsr" writes: > > > I'm usingRuby1.8.5, with SciTE as my IDE. > > > I'm not a beginner atRuby, I've been using it for about a year and a > > > half now. > > > > I just got a new computer, so I installedRubyonto it. So I open up > > > SciTE and type out a fairly long program. I run it, and all that pops > > > up is the cmd window that should compile my code. It hangs there > > > forever until I close it manually. I said "what is up with this?" and > > > I tried something. I had an inkling that it wasgets() that was > > > causing my problems, so I made a new program: > > > > name =gets("What is your name? ") > > > puts name > > > I don't think that is what you want, more likely you want something > > like: > > > puts "What is your name? " > > name =gets > > puts name > > > Look up the definition forgets, the argument for it is the record > > separator, meaning that with your code you had to type What is your > > name? to stop inputting. > > > > It still hangs! So, I make a new program, and put: > > > >gets() > > > Maybe because it waits for input? > > > Tom > > No. It doesn't take anything in. It just hangs there, until I exit the > window. I'll try it from the command line, but I've never had this > problem before. > > > puts "What is your name? " > > name = gets > > puts name > > Still, no. You think I wouldn't have tried something like that? xD I had this same problem, run it from the command line and it will be fine.