Re: Silly question
Re: Silly question
- Subject: Re: Silly question
- From: "Clark S. Cox III" <email@hidden>
- Date: Fri, 21 Dec 2001 11:50:16 -0500
Craig S. Cottingham wrote:
...I don't instantly know if it will be evaluated as
( (a && b) || (c && d) )
or
( ( (a && b) || c) && d)
To keep the precedence sorted out, just remember that && is boolean
multiplication, and || is boolean addition, so 'and' comes before 'or',
just as multiplication comes before addition:
1 * 1 == 1 <-> 1 && 1 == 1
1 * 0 == 0 <-> 1 && 0 == 0
0 * 1 == 0 <-> 0 && 1 == 0
0 * 0 == 0 <-> 0 && 0 == 0
1 + 1 == 10 <-> 1 || 1 == 1
1 + 0 == 1 <-> 1 || 0 == 1
0 + 1 == 1 <-> 0 || 1 == 1
0 + 0 == 0 <-> 0 || 0 == 0
--
Clark S. Cox, III
email@hidden
http://www.whereismyhead.com/clark/