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(1) && eval(0) && eval(-1); Console.Write($"output: {b}");
A. eval(1) eval(0) eval(-1) output: False
B. eval(1) eval(0) output: False
C. eval(1) eval(0) output: True
D. eval(1) eval(0) eval(-1) output: True
E. 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