-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Act on
non_reversible_form
as an exception to atom naming conventio…
…ns (#345) * Act on `non_reversible_form` as an exception to atom naming conventions * Update atom_naming_convention -related test * Include specific execution conditions
- Loading branch information
1 parent
6923a83
commit 7612541
Showing
3 changed files
with
45 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-module(pass_maybe). | ||
|
||
-if(?OTP_RELEASE >= 25). | ||
|
||
-feature(maybe_expr, enable). | ||
|
||
-endif. | ||
|
||
-export([sum_numbers/2]). | ||
|
||
|
||
-if(?OTP_RELEASE >= 25). | ||
sum_numbers(Number1, Number2) -> | ||
maybe | ||
ValidNumber1 ?= validate_number(Number1), | ||
ValidNumber2 ?= validate_number(Number2), | ||
ValidNumber1 + ValidNumber2 | ||
else | ||
{error, invalid_number} -> | ||
{error, "One or both inputs are invalid numbers"} | ||
end. | ||
|
||
validate_number(Number) when is_number(Number) -> | ||
Number; | ||
validate_number(_) -> | ||
{error, invalid_number}. | ||
-else. | ||
sum_numbers(Number1, Number2) -> | ||
Number1 + Number2. | ||
-endif. |
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