in reply to A matter of style: how to perform a simple action based on a simple condition?

I'd say, understand what all three do (because no matter what, you'll encounter all three styles if you're going to read other peoples code), and do whatever you find more natural at the time of writing.

I've used all three, probably option two the most. Option three is somewhat slower, as it creates a scope (and creating and tearing down a scope takes some time). But this should only matter in a tight loop.

  • Comment on Re: A matter of style: how to perform a simple action based on a simple condition?