Here’s the Deal
Slant is powered by a community that helps you make informed decisions. Tell us what you’re passionate about to get your personalized feed and help others.
The block of code itself is disconnected from the control statement which allows developers to comment out or remove entirely a control statement without having a large risk of encountering syntax errors because of extra or missing braces. See More
With this style, one of the advantages is that the opening brace does not take a whole line for itself, wasting a lot of space. The closing brace though is indented on the same level as the control statement it belongs to, making it easier to understand which block of code it's closing. See More
The K&R style uses braces only when necessary. So for example: if(condition) doSomething(); But this can be annoying if you need to put something inside that if statement, because you have to go and add braces to make sure that will be grouped correctly with the statement that was before. See More
Hard to see end of blocks, if closing brace is 'hidden' in code. See More
The fact that the code lines up up with the braces makes this by far and away the easiest style to read. The code flows much more naturally, there is zero doubt about which block the codes belongs to, your eyes are quickly drawn to what belongs where. See More
When scanning vertically through large sections of code to review the code execution flow, having the braces indented means less noise to filter out. The execution flow statements stand alone on the vertical line and are thus far more quickly picked out by the eye. See More