problem with Hello World test, window shut instantly

Discussion in 'Ruby' started by Blackthirteen Blackthirteen, Feb 2, 2009.

  1. 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 via http://www.ruby-forum.com/.
    Blackthirteen Blackthirteen, Feb 2, 2009
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    On Mon, Feb 2, 2009 at 12:48 PM, Blackthirteen Blackthirteen <
    > 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
    Yaser Sulaiman, Feb 2, 2009
    #2
    1. Advertising

  3. Blackthirteen Blackthirteen

    Reth11 Guest

    On Feb 2, 3:48 am, Blackthirteen Blackthirteen <>
    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
    Reth11, Feb 2, 2009
    #3
  4. Blackthirteen Blackthirteen <> 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...

    --
    __Pascal Bourguignon__
    Pascal J. Bourguignon, Feb 2, 2009
    #4
  5. It's because he's using windows and running it without opening a =20
    command line first

    Sent from my iPhone

    On 02/02/2009, at 11:34 PM, (Pascal J. =20
    Bourguignon) wrote:

    > Blackthirteen Blackthirteen <> writes:
    >
    >> Hello, I=81fm new to ruby. So I started with the famous Hello World p=20=


    >> rogram
    >> after installing Ruby.
    >>
    >> When I save a program as test.rb and I run it, the window open but =20=


    >> 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...
    >
    > --=20
    > __Pascal Bourguignon__
    >
    Julian Leviston, Feb 3, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    0
    Views:
    438
    Steve
    Jan 31, 2006
  2. vijay
    Replies:
    8
    Views:
    673
  3. Roy
    Replies:
    6
    Views:
    567
    Roedy Green
    Jan 7, 2008
  4. Wonyong

    To output "Hello, World!" at window

    Wonyong, Apr 13, 2011, in forum: C Programming
    Replies:
    48
    Views:
    1,019
    Matt Ryder
    Apr 23, 2011
  5. Larry
    Replies:
    27
    Views:
    402
    Michele Dondi
    Jan 25, 2005
Loading...

Share This Page