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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -