I've just had my first experience with Ruby - the newest addition to the scripting world - and was quite impressed with it. Its quite amazing at how much you can achieve with such a few lines of code (this coming from a Java developer).
Ruby is a dynamic, object oriented programming language. Its syntax is quite intuitive and is fairly easy to learn. Simplicity seems to be the operative word when programming with it. A few more facts about Ruby,
- Interpreted
- Everything is an Object (no primitives.. i mean everything's an object)
- Single inheritance with mixings (i still haven't figured out mixings.. will update this when i do)
- It has some excellent support for collections and regular expressions
- Its free!!!
Something that really impressed me was the following code snippet,
hash = {1=> 'Ricky Ponting', 2=> 'Sanath Jayasuriya'}
hash.each_pair do |key, value| puts "#{key} is #{value}"
These two lines iterate through the hash and prints out the value to the console. How cool is that?
No comments:
Post a Comment