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
=> nil
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.

Thursday, 23 January 2014

Learning Python For Beginners

 Python is a very powerful & programming language. It is used for a variety of application one of the most notable users of the Python programming language is NASA. Python  is an easy language to learn when you compare it to other languages like C and C++. This makes it a very popular choice especially amongst people who have never programmed before.It only takes a few minutes to write python code and you'd be surprised how fast you can pick it up.

Some python code examples written in IDLE python's interactive shell.

>>> print('Hello out there big wide world')
Hello out there big wide world

At the Python interpreter we have used the "print" command to simply print out some data "Hello out there big wide world" Easy!!!

Now lets use python as a calculator:

>>> print(2 + 2)

Something a little different here. Can you guess?

 >>> print('Hello new python learner ' * 2)
Hello new python learner Hello new python learner

We first print the string: 'Hello new Python learner' and we instruct our program to multiply it twice, * 2. This multiplication operator * then prints our line twice!

Python is not only a fun programming language to learn - but as previously stated it is an easy entry point for beginners wishing to become proficient in computer programming. Once more once you've learned the basics of the Python language learning any other language after that will be a snap!