mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-08 07:46:46 +02:00
[erlang/en] Fix #970
This commit is contained in:
@@ -167,8 +167,12 @@ is_dog(A) -> false.
|
|||||||
% A guard sequence is either a single guard or a series of guards, separated
|
% 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
|
% by semicolons (`;`). The guard sequence `G1; G2; ...; Gn` is true if at
|
||||||
% least one of the guards `G1`, `G2`, ..., `Gn` evaluates to `true`.
|
% 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) when is_atom(A), (A =:= dog) or (A =:= cat) -> true;
|
||||||
is_pet(A) -> false.
|
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.
|
||||||
|
|
||||||
% Records provide a method for associating a name with a particular element in a
|
% Records provide a method for associating a name with a particular element in a
|
||||||
% tuple.
|
% tuple.
|
||||||
|
Reference in New Issue
Block a user