Forum: Ruby problem with Hello World test, window shut instantly

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Blackthirteen B. (Guest)
on 2009-02-02 11:48
Hello, I’m new to ruby. So I started with the famous Hello World program
after installing Ruby.

When I save a program as test.rb and I run it, the window open but shut
very quickly. How can I see my results once I run the program I made?
Yaser S. (Guest)
on 2009-02-02 12:53
(Received via mailing list)
On Mon, Feb 2, 2009 at 12:48 PM, Blackthirteen B. <
removed_email_address@domain.invalid> wrote:

> When I save a program as test.rb and I run it, the window open but shut
> very quickly. How can I see my results once I run the program I made?


A quick fix: add "gets" to the end of your script. This will make your
program wait for your input. Once you hit Enter it will terminate.

Or you can just open the command line interface, navigate to the
directory
containing your script, and then enter its name ("test.rb" in this case)
to
execute it.

HTH,
Yaser
Reth11 (Guest)
on 2009-02-02 14:20
(Received via mailing list)
On Feb 2, 3:48 am, Blackthirteen B. <removed_email_address@domain.invalid>
wrote:
> Hello, I’m new to ruby. So I started with the famous Hello World program
> after installing Ruby.
>
> When I save a program as test.rb and I run it, the window open but shut
> very quickly. How can I see my results once I run the program I made?
> --
> Posted viahttp://www.ruby-forum.com/.

Greetings,
  I use windows. I started out with the same problem. I did start/run
and cmd. Using the Ruby in the command prompt can be a pain. The
documentation or whatever does not hint that it comes with a program/
text editor. If you go to Start, All Programs, Ruby*, and click on
SciTE. This editor is my favorite. I have tried a few others (eText
Editor and Komomdo Editor) on Windows platform and just didn't like
them.

Cheer
Pascal J. Bourguignon (Guest)
on 2009-02-02 14:36
(Received via mailing list)
Blackthirteen B. <removed_email_address@domain.invalid> writes:

> Hello, I’m new to ruby. So I started with the famous Hello World program
> after installing Ruby.
>
> When I save a program as test.rb and I run it, the window open but shut
> very quickly. How can I see my results once I run the program I made?

I would use emacs, both as an editor and as a shell window in which to
run ruby programs.  Emacs can also be used to drive an interactive
ruby session (irb).
http://www.gnu.org/software/emacs/windows/Introduction.html

Launch emacs, Read the tutorial (Control-h t).

Then you can launch a shell with: M-x shell RET
and type there your commands, such as: ruby hw.rb

For interactive ruby: M-x run-ruby RET

You can edit your files:  C-x C-f hw.rb RET

etc...
Julian L. (Guest)
on 2009-02-03 04:37
(Received via mailing list)
It's because he's using windows and running it without opening a
command line first

Sent from my iPhone

On 02/02/2009, at 11:34 PM, removed_email_address@domain.invalid (Pascal J.
This topic is locked and can not be replied to.