Page 1 of 1

About Question enthuware.ocajp.i.v7.2.973 :

Posted: Tue Jun 25, 2013 9:31 am
by zippo1000
In the explanation there are the following examples:

Code: Select all

( true || bool = false)
( true |  bool = false)
It is said that the first one wouldn't assign false to 'bool', whereas the second does. Unfortunately the compiler complains about these expressions. The reason is, that || and | comes before =. (--> operator precedence)

Maybe I miss something but I think it should be changed to the following:

Code: Select all

( true || (bool = false))
( true |  (bool = false))

Re: About Question enthuware.ocajp.i.v7.2.973 :

Posted: Sat Sep 27, 2014 7:34 pm
by Daniel Clinton
I think so too.
Assignment has the lowest precedence of all operations.
Both cases need parentheses to compile

Re: About Question enthuware.ocajp.i.v7.2.973 :

Posted: Sat Sep 27, 2014 7:48 pm
by admin
You are right. Fixed.
thank you for your feedback!