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.

`else if(...) {` supported on its own line, but not `else {`?

See original GitHub issue
    else if (...) {                           
      // ...
    }                                                                            
    else {                                                                       
      // ...
      break;                                                                     
    }                                     

I can’t figure out how get rid of 132:9 error Closing curly brace does not appear on the same line as the subsequent block brace-style, other than wrapping else up to the preceeding }, unlike all the else-if statements.

Bug, infelicity, or am I missing a config option?

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

21reactions
ghostcommented, Apr 7, 2016

Always put last else block at end of its previous block like: if(){ } else { }

0reactions
abdelmoulacommented, Aug 19, 2016

I think writing this way should solve the issue (put else at the same line as the closing bracket) : if (foo) { alert(“blah”); } else if (!foo) { alert(“second blah”); }

Read more comments on GitHub >

github_iconTop Results From Across the Web

if / else errors - learn how to fix these - Codecademy
For one thing, unlike if and else if , an else statement is not used to do condition checking. The purpose of else...
Read more >
if statement - c - if + else if + else in one line? - Stack Overflow
C disregards all whitespace characters that aren't required to separate preprocessing tokens. What's this great "virtue" of a doing things in a ...
Read more >
If Else Statements - Problem Solving with Python
An else clause is a section of code that runs if the if-statement is False . If the if-statement is True , the...
Read more >
if, else, elif :: Learn Python by Nina Zakharenko
An else statement is part of an if statement. If your if statement ran, your else statement will never run. >>> a =...
Read more >
C# - if, else if, else Statements - TutorialsTeacher
Multiple else if statements can be used after an if statement. It will only be executed when the if condition evaluates to 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