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

Deeper explanation for one-line conditional reasoning. #27

Merged
merged 2 commits into from
Aug 4, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Greater explanation for conditional reasoning.
  • Loading branch information
bcapps committed Aug 4, 2013
commit 02a5492c969b7f5d5405ca2e7b4554ceffc6c608
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) braces should still be used. There are just too many [little ways](https://github.com/NYTimes/objective-c-style-guide/issues/26#issuecomment-22074256) to get burned otherwise. These cases include adding a second line and expecting it to be part of the if-statement - we have gotten burned by this in legacy code, in which a line was added and manually indented. Another, [even more dangerous occurrence](http://programmers.stackexchange.com/a/16530) may happen where the line "inside" the if-statement is commented out, and the next line is now unwittingly (and unclearly) part of the if-statement. These particular cases are difficult to catch because the indentation is correct, while the statement is not. In addition, this style is more consistent with all other conditionals, and therefore more easily scannable.

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