Top "Or-operator" questions

The OR operator may represent the "logical boolean or" operation || or a "bitwise or" operation |. Use [sql] for questions related to the SQL "OR" keyword, and [regex-alternation] for the use of alternation construct |. Do NOT use this tag for questions only specific to [bitwise-or] operations.

Use value if it exists, else assign default using the or operator

I found this example in a book: // Create _callbacks object, unless it already exists var calls = this._callbacks || (this._callbacks = {}); …

javascript variable-assignment or-operator
How to write switch statement with "or" logic?

Below, I have created a simple switch statement that works fine. I was wondering how I could change this code …

c switch-statement or-operator
RegExp - How can I match the shortest amount possible?

I have my Regular Expression /'(.*)(?:(?:'\s*,\s*)|(?:'\)))/ and my test code ('He said, "You're cool."' , 'Rawr') (…

javascript regex or-operator
or is not valid C++ : why does this code compile?

Here is a very simple C++ application I made with QtCreator : int main(int argc, char *argv[]) { int a = 1; int …

c++ or-operator
C Relational Operator Output

#include <stdio.h> void main() { int x = 1, y = 0, z = 5; int a = x && y || z++; printf("%d", …

c logical-operators or-operator and-operator
Logical operator || in javascript, 0 stands for Boolean false?

I happened to know the following code Here is the code, and very simple: var test = 0 || -1 ; console.log(test); …

javascript boolean logical-operators or-operator