add else to docs

This commit is contained in:
Jake Teton-Landis
2015-03-10 16:50:20 -07:00
parent 3c68fc4946
commit af096c8a94

View File

@@ -637,6 +637,29 @@
}
```
- If you're using multi-line blocks with `if` and `else`, put `else` on the same line as your
`if` block's closing brace.
```javascript
// bad
if (test) {
thing1();
thing2();
}
else {
thing3();
}
// good
if (test) {
thing1();
thing2();
} else {
thing3();
}
```
**[⬆ back to top](#table-of-contents)**