Tuesday, September 13, 2011

Trips for ruby new comers

I found that the following point can trip for ruby new comers:

  • Class definition is an executable code.

  • Only nil and false will be evaluated to false in conditional  statement.

  • A statement always return a value.

  • If the last statement is a value, we don't need the return keywords in a function definition.

  • Use   do  end for multiple line of block and { } same line  for one line code block.

  • { } is optional for hash attribute when it is located in the last parameter.


Next we will show the details of each in the next chapter.

Please comment if you think there is more point that trip you.

No comments:

Post a Comment