niminst: bugfixes; documentation changes
This commit is contained in:
parent
4cfc0462a4
commit
f58cc49672
9 changed files with 70 additions and 85 deletions
14
doc/tut2.txt
14
doc/tut2.txt
|
|
@ -387,17 +387,17 @@ The `try`:idx: statement handles exceptions:
|
|||
f: TFile
|
||||
if open(f, "numbers.txt"):
|
||||
try:
|
||||
var a = readLine(f)
|
||||
var b = readLine(f)
|
||||
echo("sum: " & $(parseInt(a) + parseInt(b)))
|
||||
let a = readLine(f)
|
||||
let b = readLine(f)
|
||||
echo "sum: ", parseInt(a) + parseInt(b)
|
||||
except EOverflow:
|
||||
echo("overflow!")
|
||||
echo "overflow!"
|
||||
except EInvalidValue:
|
||||
echo("could not convert string to integer")
|
||||
echo "could not convert string to integer"
|
||||
except EIO:
|
||||
echo("IO error!")
|
||||
echo "IO error!"
|
||||
except:
|
||||
echo("Unknown exception!")
|
||||
echo "Unknown exception!"
|
||||
# reraise the unknown exception:
|
||||
raise
|
||||
finally:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue