Last active
July 6, 2019 00:05
-
-
Save fo2rist/d46bb95dbe4fc52474fad4a66affb739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// try-ignore approach | |
try { | |
doAction() | |
} catch (exc: SomePreconditionViolated) { | |
//ignore | |
} finally { | |
finalize() | |
} | |
/* ^ COMPARE v */ | |
// check-and-execute approach | |
if (canDoTheAction()) { | |
doAction() | |
finalize() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment