Ruby is dynamic,interpreted, object oriented programming languages which is one of the easiest programming language to learn and with Rails its just might be the best web development option at the moment. Ruby intsallation is pretty much simple in windows, Linux and you don't have to install Ruby on Mac. It already has Ruby installed in it.
- Go to Ruby programming language homepage: https://www.ruby-lang.org/en/
- Click downloads
- Click on Installation-->click on RubyInstaller(Windows)-->Ruby installer-->Download
- Select the top selection there that will be the current version of Ruby
- Click save file. let it download
- Now double click the file-->accept license agreement-->Install-->finish.
On ruby shell single number evaluates itself. We can perform simple arithmetic operations the ways show above screenshot. Strings also evaluate to them self, We can perform concatenation operation between two strings using '+' operator as shown below :
We can write more complicated expressions in ruby shell. We can create functions for example square function in bellow example. Here I wrote my own user define "sqr" function to find square of a number.
If you have good understanding of function you not even have to write return statement. lets consider following function for addition of two numbers. In which I wrote add method for addition of two numbers when next time I write add(2,2) it performs addition of these two numbers which is 2+2=4.