CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Short-Circuit Evaluation Counts Calls

C# code walkthrough · Question 22
hardOperators

Code

Read carefully. What does this print?
1int count = 0;
2bool Inc()
3{
4 count++;
5 return true;
6}
7bool r1 = Inc() || Inc();
8bool r2 = Inc() && Inc();
9Console.WriteLine(count);

Your answer