Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Ruby
1. Ruby
Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. From the Ruby web site at
https://www.ruby-lang.org/en/ .
Note: Ruby is a general purpose programming language.
Ruby on Rails is a server-side application framework for developing web systems, etc.
2. CentOS 7 installation
The following Linux command(s) install Ruby.
sudo yum -y install ruby
3. Installed version
The following Linux command(s) installed version of Ruby.
ruby --version
On
2019-08-16 the output was as follows.
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
4. Hello world in Ruby
The file type of a
Ruby program file is
rb.
The following Linux command(s) create/edit a hello program in the your home directory using the nano text editor.
nano ~/hello.rb
Create the following program text in the editor that will output the text "Hello world"
puts "Hello world"
To exit with save, remember to press
Ctrl-X, then "
y" (for yes) and
Enter to exit.
The following Linux command(s) run the program.
ruby ~/hello.rb
The output should be as follows.
Hello world
5. End of page