Is there a difference between "if" and "&&"? - page 2

To add comments, please log in or register
William Roeder
19852
William Roeder  
helloea: You have a lot of knowledge.

Perhaps, you should read the documentation.

Icham Aidibe
11613
Icham Aidibe  
helloea:

You have a lot of knowledge.

Yeah don't be that humble, you're just starting, no doubt that after some practice you're gonna laugh at your old post :)

Seng Joo Thio
1135
Seng Joo Thio  
helloea:

You have a lot of knowledge.

No. I just Google 😂. 
lippmaje
859
lippmaje  
Seng Joo Thio:

Before Build 600, both 'a' and 'b' are evaluated in 'if(a&&b)' regardless of 'a' being true or false - so if you have 'if(a>0 && b/a>4)', you'll crash when 'a'==0...

Oh, interesting to know. Luckily they got this fixed... even C had it right. https://en.wikipedia.org/wiki/Short-circuit_evaluation
Short-circuit evaluation - Wikipedia
Short-circuit evaluation - Wikipedia
  • en.wikipedia.org
Short-circuit evaluation, minimal evaluation, or McCarthy evaluation (after John McCarthy) is the semantics of some Boolean operators in some programming languages in which the second argument is executed or evaluated only if the first argument does not suffice to determine the value of the expression: when the first argument of the function...
12
To add comments, please log in or register