January 17, 2010 Ruby 7 comments
January 17, 2010 Ruby 7 comments
Of course not. There is a lot of interesting stuff in Ruby. But at least I tried that quick list here:
http://www.ruby-lang.org/en/documentation/quickstart/
To print something you just need to write puts keyword.
You could calculate online:
Lets define method to calculate price of one of the Dell notebooks here in Ukraine if price is in Dollars, but you want to know how much it is in Hryvnas.
Lets use it:
But Ruby is object-orient language. So here is my Exchanger class and I want to initialize it with exchanging rate:
@rate is field of that class. Don’t you see that syntax very sweet? I see.
Next, we will create instance of our class with a bit lower rate. And use that instance of class:
“In Ruby, you can open a class up again and modify it. The changes will be present in any new objects you create and even available in existing objects of that class. “
That is amazing as per me, because you could just write code after you have declaration of your class and change intent of it.
You need to try play with Ruby, that is very sweet language!