CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ruby & Ruby On Rails (http://www.codingforums.com/forumdisplay.php?f=44)
-   -   How to stop command prompt from closing after running a program! (http://www.codingforums.com/showthread.php?t=247855)

samxdesigns 01-04-2012 04:26 AM

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. :)

Cida 01-08-2012 03:33 PM

I use
Code:

gets # halts console for input
or
Code:

sleep(5) # pause for 5 seconds


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.