[Solved] What does it mean when there are two pipes (||) next to each other? [duplicate]


One pipe is a logical OR operator which always evaluates both operands.

Two pipes is short-circuiting logical OR operator, which only evaluates the second operand if the first one is false. This is especially useful if the second operand is a heavy function that you don’t want to evaluate unnecessarily or it is something that can throw an exception, e.g.:

if(myList == null || myList.Count == 0){
    //do something
}

In this example, if myList is null, the second operand is never evaluated. If we use one pipe instead, the second operand will be evaluated and will throw an exception because myList is null.

solved What does it mean when there are two pipes (||) next to each other? [duplicate]