3 ms·
In cases where I have only one statement I often drop the braces, but I also drop the newline. if (true) foo(); else bar(); Not much room for a confused b
by _0ffh 11y ago
In cases where I have only one statement I often drop the braces, but I also drop the newline.
if (true) foo();
else bar();
Not much room for a confused baz() here, or so I hope.
- hacker_9 11y agoThis is actually a worse solution. When speed reading code having control statements on their own lines is far more beneficial as you can at a glance, using the indentation, easily see what the flow of execution is.
- _0ffh 11y agoYou might find it worse, I don't. You might not be able to parse this quickly, I am. No holy wars about style please! I was just offering an alternative that works well for me.