-
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.
Merge pull request #254 from dwango/support_try_expression
Support try expression
- Loading branch information
Showing
2 changed files
with
54 additions
and
14 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
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. |