diff options
author | ven <vendethiel@hotmail.fr> | 2015-05-28 11:25:22 +0200 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2015-05-28 11:25:22 +0200 |
commit | 1386d177df87caeb2487cd8cf2430f5a261a8780 (patch) | |
tree | 06d21eea0bc1fea487d91ae605d75d6ae82aaa04 /erlang.html.markdown | |
parent | b33799a8d52b77de45505ca533f0533b39bbc1d6 (diff) | |
parent | f9649ac5529eed31a6b954b160c4e461a6bc25dd (diff) |
Merge pull request #1106 from Jubobs/master
[erlang/en] Fix #970
Diffstat (limited to 'erlang.html.markdown')
-rw-r--r-- | erlang.html.markdown | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/erlang.html.markdown b/erlang.html.markdown index 322e437d..a3b571d1 100644 --- a/erlang.html.markdown +++ b/erlang.html.markdown @@ -167,8 +167,15 @@ is_dog(A) -> false. % A guard sequence is either a single guard or a series of guards, separated % by semicolons (`;`). The guard sequence `G1; G2; ...; Gn` is true if at % least one of the guards `G1`, `G2`, ..., `Gn` evaluates to `true`. -is_pet(A) when is_dog(A); is_cat(A) -> true; -is_pet(A) -> false. +is_pet(A) when is_atom(A), (A =:= dog) or (A =:= cat) -> true; +is_pet(A) -> false. + +% Warning: not all valid Erlang expressions can be used as guard expressions; +% in particular, our `is_cat` and `is_dog` functions cannot be used within the +% guard sequence in `is_pet`'s definition. For a description of the +% expressions allowed in guard sequences, refer to this +% [section](http://erlang.org/doc/reference_manual/expressions.html#id81912) +% of the Erlang reference manual. % Records provide a method for associating a name with a particular element in a % tuple. |