I don’t like or not a fan of Ruby’s ‘unless’ keyword. I mean its nice but it take time to get used to.
Sample ‘unless’ statements like this:
1
|
|
The code statement above is nice and easy. I’d say that in english “Print the product’s name unless the product doesn’t have a name”.
Why do we need unless? Let replace it with something else:
1 2 3 4 5 |
|
Then we can code:
1
|
|
So far so good, that’s much better, ‘unless’ never made it into mainstream language.
OO scripting languages like Ruby can make new keyword. :)