Skip to content

Commit

Permalink
Include specific execution conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ferraz-oliveira committed Jun 5, 2024
1 parent b341dbc commit bf092db
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/examples/pass_maybe.erl
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
-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),
Expand All @@ -19,3 +24,7 @@ validate_number(Number) when is_number(Number) ->
Number;
validate_number(_) ->
{error, invalid_number}.
-else.
sum_numbers(Number1, Number2) ->
Number1 + Number2.
-endif.

0 comments on commit bf092db

Please sign in to comment.