question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opinion on formatting if else if else block?

See original GitHub issue

I know what I would choose but I thought I would mention it here. What’s the style guide for if else if else formatting.

if (condition) {
  //stuff
} else {
  //stuff
}

vs

if (condition) {
  //stuff
}
else {
  //stuff
}

I think the choice is obvious but, “I’ve heard it both ways”.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:17

github_iconTop GitHub Comments

4reactions
jcurtiscommented, May 21, 2018

thread necromancy

I think he meant reviving this discussion thread, not the JS thread

2reactions
ljharbcommented, Dec 23, 2015
Read more comments on GitHub >

github_iconTop Results From Across the Web

Formatting of if Statements - Stack Overflow
I find this: if( true ) { DoSomething(); } else { DoSomethingElse(); }. better than this: if( true ) DoSomething(); else DoSomethingElse();. This...
Read more >
Using Conditional Formatting: If Statements in Excel
The answer is yes and no. Any conditional formatting argument must generate a TRUE result, meaning that at a literal level, your conditional...
Read more >
How to Combine Conditional Formatting with an IF Statement
One of the methods to achieve Conditional formatting based on a custom formula is using the IF statement. The IF function works on...
Read more >
if / else errors - learn how to fix these - Codecademy
First off, a quick review of what if statements look like.​​ Depending on what you are checking for, the else if and else...
Read more >
C - if...else statement - Tutorialspoint
C - if...else statement, An if statement can be followed by an optional else statement, which executes when the Boolean expression is false....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found