DEV Community

loading...

Discussion on: Write better code and be a better programmer by NEVER USING ELSE statements

Collapse
psanchez1982 profile image
Patricio Sanchez Alvial

So your problem is identation?

if(condition){
...
}
else{ // you can put else here
...
}

Collapse
dglsparsons profile image
Douglas Parsons Author

Hey. Thanks for taking the time to read the article and sharing your thoughts.

My issue isn't with the indentation of the else keyword, but more that the happy-path code, and error-handling code are both indented within the if {} else {} statement - it makes them harder to distinguish from a quick scan.