From 5017e2e7363ccc2ae350d86bf43f6f579f6a50a0 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 16 Jan 2025 13:17:46 +0000 Subject: [PATCH] doc: add try-catch-finally example file --- doc/sample/Exception.im | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 doc/sample/Exception.im diff --git a/doc/sample/Exception.im b/doc/sample/Exception.im new file mode 100644 index 0000000..a6a1f8b --- /dev/null +++ b/doc/sample/Exception.im @@ -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