[erlang-questions] guard clause oddity, maybe bug (in my brain)?
Sat Nov 21 07:16:52 CET 2015
On 11/20/2015 08:27 PM, Jim wrote:
> Thank you both, I guess I don't fully understand the associative and precedence of these operators.
This seems a sensible way to look at it:
1> false andalso false orelse true.
2> ((false andalso false) orelse true).
3> (false andalso (false orelse true)).
andalso and orelse are described in the docs as
Expr1 orelse Expr2
Expr1 andalso Expr2
You *have* to have two expressions for a given andalso/orelse, so you
read expression 1 up there from left to right.
false andalso false (which is -obviously- false, and becomes the Expr1
of the next expression)
false orelse true (which is true)
Does that make sense?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the erlang-questions