[erlang-questions] Re: If one guard expression in the guard fails, are the remaining expressions still evaluated?

Alexey Romanov <>
Sun Feb 20 18:01:09 CET 2011


> If a guard statement does return false it will not continue executing if , are used

That's precisely what I was asking about. Thank you!

Yours, Alexey Romanov


> ----- Original Message -----
> From: "Alexey Romanov" <>
> To: "Steve Davis" <>
> Cc: 
> Sent: Sunday, February 20, 2011 3:46:27 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
> Subject: Re: [erlang-questions] Re: If one guard expression in the guard fails, are the remaining expressions still evaluated?
>
> I've asked precisely because reading section 7.24 didn't clarify it
> for me. The relevant sentences are "The guard is true if all guard
> expressions evaluate to true." and "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." The
> first sentence suggests to me that all expressions are evaluated; the
> second that expressions after the one that failed aren't. But both
> aren't explicit.
>
> I know about short-circuit expressions, but 7.14 doesn't say anything
> about evaluation of guards (unsurprisingly).
>
> Yours, Alexey Romanov
>
>
>
> On Sun, Feb 20, 2011 at 4:31 PM, Steve Davis
> <> wrote:
>>
>> Take a look at section 7.14 (Short-Circuit Expressions) as well as 7.24 of
>> that chapter. It should clarify.
>>
>> /s
>>
>> --
>> View this message in context: http://erlang.2086793.n4.nabble.com/If-one-guard-expression-in-the-guard-fails-are-the-remaining-expressions-still-evaluated-tp3315062p3315110.html
>> Sent from the Erlang Questions mailing list archive at Nabble.com.
>>
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:
>>
>>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>


More information about the erlang-questions mailing list