[erlang-questions] difference between ", " and "andalso" in guards

ok <>
Tue May 20 07:43:56 CEST 2014


Can we put this simply?

Inside a guard, if there is an exception anywhere in
a guard test, the entire test is taken as false.

(G1 , G2) and (G1 ; G2) contain guard tests but are not
guard tests themselves.

(G1 andalso G2) and (G1 orelse G2) contain guard
tests are *are* guard tests themselves: a failure in
in G1 or G2 fails the *whole* guard test.

Or to put it even more simply: 'andalso' and 'orelse'
are transparent to exception failure, while ',' and
';' and '->' are not.






More information about the erlang-questions mailing list