From: Tim Roberts Date: 2010-11-17T15:45:20+09:00 Subject: Re: gets() not stopping to accept input Rubist Rohit wrote: >I am using "Programmers Notepad" to write Ruby code. I tried following >code, but gets() is not waiting to accept the input. The whole program >execution finishes when I run the program. > >========= CODE ========== >puts 'Enter your name' >name = gets() >puts 'Hello #{name}' >========================= Unless you are specifying a file name on the command line, you probably want this to read from the console. For that, you need STDIN.gets. Also, the string substitution in your third line will only happen if you use double quotes. So, I think you want: puts 'Enter your name' name = STDIN.gets puts "Hello #{name}" -- Tim Roberts, timr@probo.com Providenza & Boekelheide, Inc.