Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #27 from NYTimes/one-line-conditionals
Browse files Browse the repository at this point in the history
Deeper explanation for one-line conditional reasoning.
  • Loading branch information
mbbischoff committed Aug 4, 2013
2 parents 1559413 + 691a98a commit 2705760
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ else {

## Conditionals

Conditional bodies should always use braces even when a conditional body could be written without braces (i.e., it is one line only) braces should still be used. There are just too many little ways to get burned otherwise.
Conditional bodies should always use braces even when a conditional body could be written without braces (i.e., it is one line only) to prevent [errors](https://github.com/NYTimes/objective-c-style-guide/issues/26#issuecomment-22074256). These errors include adding a second line and expecting it to be part of the if-statement. Another, [even more dangerous defect](http://programmers.stackexchange.com/a/16530) may happen where the line "inside" the if-statement is commented out, and the next line unwittingly becomes part of the if-statement. In addition, this style is more consistent with all other conditionals, and therefore more easily scannable.

**For example:**
```objc
Expand Down

0 comments on commit 2705760

Please sign in to comment.