Search This Blog

Thursday, August 9, 2012

Ruby Introduction

Ruby is an object oriented , dynamic programming language which is designed in a way to use it easily. It's created with an aim of making programmers more productive by allowing them to concentrate on logic rather than implementation and syntax.
By object oriented i mean everything is object in Ruby. Even primitive data types of other languages like numbers are objects in ruby.
For example, you can actually do,
5.to_s
It returns "5" which is a string. 'to_s' is a method which acts on the number(object) 5 and returns a string!!
You can verify what am saying by typing the following command,
5.class
It returns the class name of 5, which is 'Fixnum'
"hello".class would return class name as 'String'

By the way did i tell you to use irb(interactive ruby shell) for trying out these commands? 
It's very helpful in exploring ruby as a beginner.
There are tons of websites providing you tutorials on Ruby.

Most programmers are strong only with the syntax of C. Sadly , Ruby's syntax is very different from C's. Today i was just trying out variable initialization, getting and setting values, arrays, loops, conditional statements in Ruby. It will take some time for getting used to the syntax. I will work with some interesting program and keep posting more about Ruby in coming days.
See you in next post! 

No comments:

Post a Comment