DEV Community

Discussion on: Else Before If In Rust

Collapse
 
b0c1 profile image
b0c1

Great, but disagree.
Usually, your "normal case" is the "fallback" method in the control statement, because the else statement is optional and not necessary.
Your normal case is unnatural, because:

  • you always expect a "normal" way
  • and when not run the normal way? you may need to check all condition
  • so you first need to skip the normal way and scroll down to all other condition

The try/catch "normal case" is different. In try/catch you will try to do something and if something wrong you create a fallback.

but this is only my opinion :D