Ruby does not need any introduction because it’s say everything itself,
Ruby is a pure object-oriented programming language. It was developed in 1993 by Yukihiro Matsumoto of Japan.
It was designed for programmer productivity with the idea that programming should be fun for programmers.
Ruby is “A Programmer’s Best Friend”.
Ruby is a scripting language like Python and Perl.And it’s a true object-oriented language.
Some Features of Ruby:-
Free-format – You can start writing your program from any line and column.
Case sensitive – Lowercase letters and uppercase letters are distinct. The keyword end, for example, is completely different from the keyword END.
Comments – Anything following an unquoted #, to the end of the line on which it appears, is ignored by the interpreter. Also, to facilitate large comment blocks, the ruby interpreter also ignores anything between a line starting with =begin and another line starting with =end. This only works if the = signs are the first characters of each line.
Statement delimiters – Multiple statements on one line must be separated by semicolons, but they are not required at the end of a line; a linefeed is treated like a semicolon. If a line ends with a backslash (), the linefeed following it is ignored; this allows you to have a single logical line that spans several lines.
Keywords – Also known as reserved words (around 42 of them) in Ruby typically cannot be used for other purposes. You may be used to thinking that a false value may be represented as a zero, a null string, a null character, or various other things. But in Ruby, all of these *values* are true; in fact, everything is true except the reserved words false and nil. Keywords would be called “reserved words” in most languages and they would never be allowed as identifiers. The Ruby parser is flexible and does not complain if you prefix these keywords with @, @@ or $ prefixes, or sigils, and use them as an instance, class or global variable names, respectively. The best practice is to treat these keywords as reserved.
Install Ruby on your Linux system using this command
$sudo apt-get install ruby-full
To check it is install properly run the below command.
This command returns the current version of ruby in your Linux system.
Let’s write the first program in ruby
Open your text editor and Past below code and save as test.rb.
puts “Hello world!”
open your terminal. Write below command.
chmod +x test.rb
You should see the message Hello world! displayed if Ruby is installed correctly.
Yeeee it’s working ….:)