proposal: add functionality to remove repetitive if err != nil return #16225
Labels
error-handling
Language & library change proposals that are about error handling.
FrozenDueToAge
LanguageChange
Proposal
Milestone
Great language but kind of tired of writing:
Proposing something similar to 'defer' except with a condition where you declare the statement after the variable is defined. Using 'try' in the example but feel free to replace 'try' with your favorite exception handler like 'rescue' et al. If the condition in the 'try' is true the block executes. Currently, thinking the block should always have a return so it only executes once. Thinking the statement should be treated as if the compiler inserted it after every assignment of the variable(s) in the condition
or
The text was updated successfully, but these errors were encountered: