Saturday, 5 January 2008

Ruby Has No "for" Loop - Woo Hoo!

I held onto my hat when I heard this one. I use the 'for' loop in Java a lot. Probably more than I ought. 'How will this work' I thought? No 'for' loop? Nonsense ...

When I saw it I liked it. Its often said (by me too earlier) that one of the reasons Ruby is so great is that it reads. Well, here's another example of just that. I like.

Glorious Negated "if" - "unless"

It continues! More and more comfort and joy ... Behold:

Ahhhh! A warm hug from my code.

Ruby If Expressions- Terse and Legible

More Ruby Pickaxe Learning. "if" expressions today (not "if" statements either - they return values don't you know). I was pleased to see just how terse and legible they can be: