[erlang-questions] Reading, Learning, Confused
Sat Jul 19 16:55:28 CEST 2008
I cannot imagine of any situation where or and orelse work the same and
reinstalling changes that. Please could you paste your exact code and shell
session, showing the problem? Also, which version of Erlang are you using?
On Sat, Jul 19, 2008 at 10:51 AM, Sean Allen <sean@REDACTED>
> On Jul 19, 2008, at 10:47 AM, Edwin Fine wrote:
> You are getting twisted in knots.
>> 1> X =0.
>> 2> (X == 0) orelse (1/X > 2).
>> 3> f().
>> 4> X = 1.
>> 5> (X == 0) orelse (1/X > 2).
>> 8> f().
>> 9> X = 0.
>> 10> (X == 0) or (1/X > 2).
>> ** exception error: bad argument in an arithmetic expression
>> in operator '/'/2
>> called as 1 / 0
>> So the orelse construct works as advertised. It will not evaluate any
>> expressions after the first false condition and prevents divide by zero.
> i need to reinstall because orelse doesnt for me. it works the exact same
> but assuming i get a working install the reason in the example that or
> fails is because of the divide by zero correct?
> which raises a new question...
> why does or evaluate all the conditions? what purpose does that serve? when
> would you use or instead of orelse?
The great enemy of the truth is very often not the lie -- deliberate,
contrived and dishonest, but the myth, persistent, persuasive, and
unrealistic. Belief in myths allows the comfort of opinion without the
discomfort of thought.
John F. Kennedy 35th president of US 1961-1963 (1917 - 1963)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions