Changeset 30737
- Timestamp:
- 03/04/08 00:25:26 (2 years ago)
- Location:
- trunk/WebKitSite
- Files:
-
- 2 modified
-
ChangeLog (modified) (1 diff)
-
coding/coding-style.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitSite/ChangeLog
r30094 r30737 1 2008-03-04 Mark Rowe <mrowe@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Add a note about preferring if over else if when the previous if is terminated by a return statement. 6 7 * coding/coding-style.html: 8 1 9 2008-02-08 Adam Roben <aroben@apple.com> 2 10 -
trunk/WebKitSite/coding/coding-style.html
r29874 r30737 202 202 </li> 203 203 204 <li>An elsestatement should go on the same line as a preceding close brace.204 <li>An <code>else</code> statement should go on the same line as a preceding close brace. 205 205 <h4 class="right">Right:</h4> 206 206 <pre class="code"> … … 218 218 } 219 219 else { 220 ... 221 } 222 </pre> 223 </li> 224 225 <li>An <code>else if</code> statement should be written as an <code>if</code> statement when the prior <code>if</code> concludes with a <code>return</code> statement. 226 <h4 class="right">Right:</h4> 227 <pre class="code"> 228 if (condition) { 229 ... 230 return someValue; 231 } 232 if (condition) { 233 ... 234 } 235 </pre> 236 237 <h4 class="wrong">Wrong:</h4> 238 <pre class="code"> 239 if (condition) { 240 ... 241 return someValue; 242 } else if (condition) { 220 243 ... 221 244 }