c# - How to return true if one of 4 bools is true -


i trying realise method, returns true, if 1 of several bools true.

bool = false; bool b = false; bool c = true; bool d = false;  private bool oneofthem() {    return && b && c && d; } 

this doesn't work. how make work?

use or (||) instead of && operator.......

|| operator (c# reference) - msdn

the conditional-or operator (||) performs logical-or of bool operands. if first operand evaluates true, second operand isn't evaluated. if first operand evaluates false, second operator determines whether or expression whole evaluates true or false.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -