doc: add try-catch-finally example file
This commit is contained in:
12
doc/sample/Exception.im
Normal file
12
doc/sample/Exception.im
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
try
|
||||||
|
x = 0
|
||||||
|
--v = Int parse:'342'
|
||||||
|
catch (#err:number_format, err) in
|
||||||
|
x = 1
|
||||||
|
--cout put:'Cannot parse integer string ({err})'
|
||||||
|
catch (_, err) in
|
||||||
|
x = 2
|
||||||
|
--cout put:'Unknown error occurred ({err})'
|
||||||
|
finally
|
||||||
|
x = 3
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user