[erlang-questions] style question - best way to test multiple non-guard conditions sequentially

Richard A. O'Keefe ok@REDACTED
Fri Jun 21 01:45:15 CEST 2013


On 21/06/2013, at 4:27 AM, Jonathan Leivent wrote:
> OK - that is surprising.  That certainly changes my thinking about if statements.  Is this particular semantic difference between guards and general conditions ever expressed in the reference manual?  If so, I certainly missed it.

Yes it is.

Section 7.24 "Guard Sequences", where guards are described.

http://www.erlang.org/doc/reference_manual/expressions.html#id80042

At the end, there is this sentence:

	If an arithmetic expression, a boolean expression, a short-circuit
	expression, or a call to a guard BIF fails (because of invalid
	arguments), the entire guard fails . If the guard was part of
	a guard sequence, the next guard in the sequence (that is, the
	guard following the next semicolon) will be evaluated.


It's also explained clearly in the Erlang books I've read.




More information about the erlang-questions mailing list