OR, AND Operator

前端 未结 8 2101
臣服心动
臣服心动 2021-02-13 15:30

Newbie question. How to calculate the value of the formula A f B, where f - the binary function OR or AND?

8条回答
  •  死守一世寂寞
    2021-02-13 16:30

    Use '&&' for AND and use '||' for OR, for example:

    bool A;
    bool B;
    
    bool resultOfAnd = A && B; // Returns the result of an AND
    bool resultOfOr = A || B; // Returns the result of an OR
    

提交回复
热议问题