From: Jeremy Bopp Date: 2011-03-17T06:02:55+09:00 Subject: Re: How to View Output - Stop App On 3/16/2011 15:30, Rob Gu wrote: > Greetings, total noob question I'm sure. I'm trying to run a simple > example in a console, but how do I tell it to stop so I can view the > output? In C# I think I could just return false or something, but what > do you do in Ruby? > > puts "Hello, world. What is your name?" > myname = gets() > puts "Well, hello there " + myname + "." > [so here it just closes out, but I want to see the greeting :( ] If you're running ruby without any arguments and then typing your script in directly, you need to send the end of file character at the end of the script. Since you mention C#, you're probably running on Windows with the cmd console. In that case, type Ctrl-Z and then Enter. If you're at a Unix terminal or running under Cygwin, type Ctrl-D. A better way to try things out is to put them into a file and then run the file using ruby. This will allow you to easily go back and make changes without having to retype everything. An even better way to try simple stuff out like this is to use irb. The irb program gives you a prompt that takes ruby code line-by-line and executes it, giving you a result after each line or complete statement. It's very handy. -Jeremy