May 12, 2021 Ruby
If you want to set up an environment for the Ruby programming language, read this section. T his chapter will show you all the important topics related to environment settings. It is recommended to learn the following topics before going any further into the other topics:
Ruby installation on Linux/Unix: If you want to configure your development environment on Linux/Unix, check out this section.
Ruby installation on Windows: If you want to configure your development environment on Windows, check out this section.
Ruby command line options: This section lists all command line options that you can use with the Ruby interpreter.
Ruby Environment Variables: This section lists all the important environment variables and sets them up for ruby interpreters to work.
In order to write a Ruby program, you need an editor:
Interactive Ruby (IRb) provides a shell for the experience. Within the IRb shell, you can view the results of the interpretation line by line immediately.
This tool comes automatically with Ruby's installation, so you don't need to do anything extra for IRb to work.
Just type irb in the command prompt, and an interactive Ruby Session will start, as follows:
$irb irb 0.6.1(99/09/16) irb(main):001:0> def hello irb(main):002:1> out = "Hello World" irb(main):003:1> puts out irb(main):004:1> end nil irb(main):005:0> hello Hello World nil irb(main):006:0>
Here you can first not care about the execution of the above commands, we will explain to you in a later section.
Let's say you've set up your Ruby environment now and are ready to write your first Ruby program. In the next chapter we'll show you how to write a Ruby program.