How to get ruby script.rb


Sorry for a dumb question, but I just started to learn Ruby from Code Academy, and I would like to practice learned codes. I downloaded Ruby and launched it, but all I get is dos like window, which allows me to enter single line then execute. Is there a place download a program, which allows me to writhe multiple codes like one in Code Academy? Thanks in advance.

You’re meant to direct code into ruby, or tell ruby to read from a file by providing a path to your code when starting ruby

In a way it’s a dumb question, yes, because these are some of the most basic operations you’d do with a computer. Running a program. But certain os’s teach you to click buttons instead.

I suggest writing code to a file, saving it somewhere under your user directory, and opening whatever terminal/console application you’ve got available and typing:

ruby helloworld.rb

(or whatever you named the file)

If you’re unable to open a terminal at that location, provide a full path to your file, and if ruby isn’t recognized, provide a full path to your ruby executable

You are using a text editor to write the program, and use the command line to execute it.

There are many free text editors available. I personally like (for instance) jEdit or Editra, but everyone has his own preferences in this respect.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.