I’ve been doing a lot of Ruby work lately and love the concise yet readable syntax. But its also tainting my appreciation for other languages. Instead of writing this in Ruby…
return if (!something)
… PHP/Delphi/C++ makes me write something like this:
if (!something) {
return false;
}
return false;
}
Of course you can pull off this one-liner PHP/C++, but its nowhere near as readable as the Ruby version, especially when something is an expression of any complexity.
if (!something) return false;
Ah well.
Advertisement
You can, of course, return
Result := Something;
Nick – but Delphi won’t return at that point, it’ll keep executing. The real power is in doing something like:
print tags.join(“, “) if (tags)