Go Back   CodingForums.com > :: Server side development > Ruby & Ruby On Rails

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-04-2012, 04:26 AM   PM User | #1
samxdesigns
New Coder

 
Join Date: Jul 2011
Location: Canada
Posts: 60
Thanks: 5
Thanked 0 Times in 0 Posts
samxdesigns is an unknown quantity at this point
How to stop command prompt from closing after running a program!

Hi I'm learning ruby, I just started and when I save and run a .rb file, it opens up in cmd, it does what it's supposed to do but then shuts down immediately after getting the results of the thing it's supposed to do.

It's really really nooby/beginner but I just started learning,

Code:
puts 10+20
So I was wondering if there is a certain command in ruby like there is in a batch or .bat file.

Example - You can enter
Code:
pause
at the end of the file and command prompt will pause after running the code.

If you can help me it would be very greatly appreciated seeing as I can't really move on and it's frustrating me.

Thanks,
Sam.
__________________
Check out my new forums: http://www.moderncoding.co.nr (:

Strengths: HTML & CSS.


Code:
EpicFriends x = 
players.getNearest(BestFriend);
if (x != null) {
x.interact("High Five" + x.getName());
samxdesigns is offline   Reply With Quote
Old 01-08-2012, 03:33 PM   PM User | #2
Cida
New to the CF scene

 
Join Date: Aug 2010
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Cida is an unknown quantity at this point
I use
Code:
gets # halts console for input
or
Code:
sleep(5) # pause for 5 seconds

Last edited by Cida; 01-08-2012 at 04:25 PM..
Cida is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:44 PM.


Advertisement
Log in to turn off these ads.