lenelex.com
Home
Quizzes
Games
Register
Log in
Question 1 of 2
What is the output of the following code fragment?
Func<int, bool> eval = x => { Console.Write($"eval({x}) "); return x > 0; }; bool b = eval(0) && eval(1); Console.Write($"output: {b}");
A. eval(0) output: False
B. eval(0) output: True
C. eval(0) eval(1) output: False
D. eval(0) eval(1) output: True
Logical AND (&&)
If the first operand is false, then then the second operand is not evaluated.
Links:
The Conditional AND Operator (&&)
Func<T,TResult> Delegate