Hello, Folks. Welcome to my tutorial series on Ruby programming language.
- Developed by Yukihiro Matsumoto in 1993
- Scripting language
- Object oriented language
- Open source
- Interpreted language
- Simple and Powerful
- Clean and Easy Syntax
- Low learning Curve
Ruby is very simple that a minimalistic program can be written in a line. Let’s begin with a hello world:
puts "Hello World"
The above line of code is enough to print a “Hello World”. Cool!! Isn’t it?
Ruby program file should end with ‘.rb’ extension.
To run a ruby program named ‘helloworld.rb’, open a command terminal window and run – “ruby helloworld.rb”
Interactive Ruby (IRb):
Interactive Ruby provides a shell to experiment with ruby codes. Within the shell, you can run ruby codes and see the results.
To open an IRb shell, type irb in command prompt and an Interactive Ruby session will start. Below is a screenshot of command prompt with an IRb session.
Hope you have set up a ruby environment and ready for playing with ruby. I have some exercises for you guys:
- Write a ruby program that prints “Hello World”
- Write a ruby program that prints the result of 3 + 2