<p dir="ltr">You can use paranthesis with andalso and orelse <br></p>
<p dir="ltr">Sergej</p>
<div class="gmail_quote">On Jan 5, 2015 9:51 AM, "Martin Koroudjiev" <<a href="mailto:mrtndimitrov@gmail.com">mrtndimitrov@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
First of all - Happy New Year!<br>
<br>
Suppose we have a function that accepts 2 integers and we want to react<br>
only when both integers are greater than 0 and one of them is less than 100:<br>
<br>
I tried:<br>
(dilbert@Martin-PC)1> F = fun(N, M) when N > 0, M > 0, N < 100; M < 100<br>
-> cool; (_, _) -> not_cool end.<br>
#Fun<erl_eval.<a href="tel:12.106461118" value="+12106461118">12.106461118</a>><br>
(dilbert@Martin-PC)2> F(1,2).<br>
cool<br>
(dilbert@Martin-PC)3> F(1,200).<br>
cool<br>
(dilbert@Martin-PC)4> F(0,200).<br>
not_cool<br>
(dilbert@Martin-PC)5> F(0,50).<br>
cool<br>
<br>
The last is not correct.<br>
What is the order of evaluation of the guards? Sadly parentheses are not<br>
allowed in guards.<br>
<br>
Best regards,<br>
Martin<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>