+ 3

While (0&&0) Question

I had a quiz where while (0&&0) was false and therefore was ignored but why is this so? I tought the && compares both and when they're the same the condition turns to true so if (false==false) its actually true (?) please enlighten me

28th Apr 2017, 8:02 AM
Vodolle
Vodolle - avatar
5 ответов
+ 8
&& is not a compare statement it's an AND conditional even if you had (1&&0) the while would have been ignored as it need the left predicate as well as the right to be true (p1 && p2 && p3){ // do shtuff } the above statement need ALL 3 predicates to be true in order to do shtuff (p1 == p3){ // do other shtuff } the above statement need p1 to be equal to p3 (both can be false for the other shtuff to happen)
28th Apr 2017, 8:27 AM
Burey
Burey - avatar
+ 2
@Ty Ler and @Burey I understood it, thanks ^^
28th Apr 2017, 3:12 PM
Vodolle
Vodolle - avatar
+ 1
&& and == do not equal the same thing. They are two different ways to compare conditions. && is used to determine Boolean expressions. While == is used to compare two sides as equal. 0 && 0 // False false && false // False 0 == 0 // True 0 == false// Valid Statement 1 == true// Valid Statement Fun Fact: Any number that does not equal 0 is true. 0 is the only number that can represent false. All other number can be considered true. -99 && 67 // True -99 && 0 // False
28th Apr 2017, 2:50 PM
Ty Ler
Ty Ler - avatar
0
Guide:: And: False&&False=False
28th Apr 2017, 9:47 AM
mei
mei - avatar
0
can any one tell me the meaning of becon ?
1st May 2017, 8:02 PM
Abdul Sami
Abdul Sami - avatar