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