Monday, 27 January 2014

Learn Ruby Programming The Easy Way


The Ruby Programming languages is probably one of the easiest and most fun of all programming languages to learn. It has been around now for a good 20 years or so and has of recent gained tremendous popularity through Ruby on rails its web application framework.

For new learners of Ruby one of the things that stands oiut the most is its plain English syntax. It's simply a very easy language to understand as well as being very powerful.

Okay lets dive into an example or two using this scripting language. First off we have a simple hello world program. This is the standard way to kick off a tutorial in the programming world.

Firstly, you'll need to install interactive Ruby which can be invoked at the command line via irb. This will allow you to write simple lines of code and see them in action.

irb(main):001:0> puts('hello world' * 5)
hello worldhello worldhello worldhello worldhello world

Here I've used the * multiplication operator to times the output by 5, hence hello world is written 5 times!
irb(main):001:0> array = ['hello',1,'you',8]
=> ["hello", 1, "you", 8]
irb(main):002:0> puts array.length
4
=> nil
irb(main):003:0>
Here we have a standard array that contains words and numbers. And underneath it we have used the 'length' feature to return its length = 4.

Those are just a few examples of the Ruby language in action. To learn more the following self teach book is an invaluable source for any learner of the Ruby programming language.

No comments:

Post a comment