Sunday, September 13, 2009

Workshop 4

I have spent a couple of hours on the coding examples at http://www.fincher.org/tips/Languages/Ruby/, I found these tutorials good for the basics and learnt a few extra things on top of what I had already picked up. Also, a couple of different ways of doing similar things. I have become more familiar and confident with the basic functionality of Ruby through this workshop.

The syntax for a Javascript "If" statement is as follows:
  • if (condition) { code to be executed if condition is true }

The syntax for a Ruby "If" statement is as follows:

  • if object < method =" action">

The major difference here is the use of parentheses. Ruby is written with perentheses for purpose of precedence, while in Java conditions must be inside perentheses and curly brackets are used around the code block.

Some of the similarities between Java and Ruby include:

  • They both include public, private and protected methods
  • Memory is managed via a "grabage collector"
  • Both are object-orientated languages

References

No comments:

Post a Comment