Skip to content

Commit 20cce8f

Browse files
committed
Merge pull request airbnb#248 from justjake/else
add `else` to docs
2 parents 656a8f6 + af096c8 commit 20cce8f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,29 @@
637637
}
638638
```
639639
640+
- If you're using multi-line blocks with `if` and `else`, put `else` on the same line as your
641+
`if` block's closing brace.
642+
643+
```javascript
644+
// bad
645+
if (test) {
646+
thing1();
647+
thing2();
648+
}
649+
else {
650+
thing3();
651+
}
652+
653+
// good
654+
if (test) {
655+
thing1();
656+
thing2();
657+
} else {
658+
thing3();
659+
}
660+
```
661+
662+
640663
**[⬆ back to top](#table-of-contents)**
641664
642665

0 commit comments

Comments
 (0)