Nim has try finally that can be used for this, and in my view it makes more
sense than an else clause on a try.
import std/strutils
proc parseAnInt(s: string) =
try:
discard parseInt(s)
finally:
if getCurrentException() == nil:
echo "We did parse"
parseAnInt"10"
parseAnInt"hello"
Run
- try except else markus_gritsch
- try except else ElegantBeef
- try except else Araq
- try except else PMunch
- try except else markus_gritsch
- try except else PMunch
- try except else mardiyah
- try except else sls1005
