-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e17b13a
commit df90cd5
Showing
1 changed file
with
30 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
-module(try_catch_expr). | ||
|
||
-export([main/0]). | ||
-export([catch_expr/0, expr_try1/0, expr_try2/0, expr_try3/0]). | ||
|
||
-spec main() -> any(). | ||
main() -> | ||
-spec catch_expr() -> any(). | ||
catch_expr() -> | ||
catch 1 + 2. | ||
|
||
|
||
|
||
-spec expr_try1() -> number(). | ||
expr_try1() -> | ||
try | ||
1 + 2 | ||
catch | ||
Err:Stack -> {hoge, Err, Stack} | ||
end. | ||
|
||
-spec expr_try2() -> number(). | ||
expr_try2() -> | ||
try 1 + 2 of | ||
X -> 2 * X | ||
catch | ||
Err:Stack -> {hoge, Err, Stack} | ||
end. | ||
|
||
-spec expr_try3() -> ok. | ||
expr_try3() -> | ||
try 1 + 2 of | ||
X -> 2 * X | ||
catch | ||
Err:Stack -> {hoge, Err, Stack} | ||
after | ||
ok | ||
end. |