Questions tagged [logical-operators]
Logical operators are symbols that aid in evaluating boolean expressions. These are found in just about every programming language that supports boolean. Common examples are && (AND), || (OR), ! (NOT), == ([value] equal to), === ([value and type] equal to), >= (Greater than or equal to), <= (Less than or equal to), > (Greater than), and < (less than)
logical-operators
2,619
questions
2
votes
1
answer
68
views
comma, AND and vertical bar operator "|"
This may seem like a stupid question, please bear with me. I wanted to confirm what a comma evaluates to so I did the following.
xy <- c(1:10)
ab <- c(10, 2, 1, 6, 8, 6, 7, 2, 10, 6)
# I ran ...
-3
votes
0
answers
14
views
How do I check whether the statement is True or False in respect to logical and identity operators? [closed]
How do I check whether the statement is True or False in respect to logical and identity operators?
Here is the statement; True and not False and True or not False
Here is what i tried; 'True and True ...
0
votes
2
answers
56
views
Using an outer Boolean variable inside a mongodb aggregation pipe line logical operator $or
I have to check a Boolean flag and base on its condition return different data result.
for example I have a collection of books and their prices, normal result of query is prices matching 10, BUT IF ...
0
votes
1
answer
33
views
Incorrect OR evaluation of cell range
Edited
I have a custom formula in conditional fange that fails to do the expected.
The condition depends on 3 factors with AND and OR spanning on a range from line 2 to 726.
=and(X2>1000,OR(AC2=&...
-1
votes
1
answer
73
views
Is there any better way to write this piece of code? [duplicate]
I am a beginner in this, I was curious if i can write the below code
more efficiently.
I can't use loops or conditional statements, just logical operators.
double a = Double.parseDouble(args[0]...
1
vote
1
answer
107
views
Why do Ruby ERB if statements set variables to nil?
I'm using ERB to generate a set of instructions with location data, and want to accept an offset in my input. When I try to check if that offset is present however, it sets it's value to nil. If ...
0
votes
0
answers
49
views
"OR" condition between two different labels in PromQL
I am using PromQL. I have different labels that represent the same thing for different environments. For example:
http_server_request{env=~"$env"}
It works fine for the dev environment, but ...
1
vote
1
answer
42
views
Python Dataframe avoid non-NaN values dropping during <> operations
My code:
xdf = pd.DataFrame(data={'A':[-10,np.nan,-2.2],'B':[np.nan,2,1.5],'C':[3,1,-0.3]},index=['2023-05-13 08:40:00','2023-05-13 08:41:00','2023-05-13 08:42:00'])
xdf =
A ...
1
vote
3
answers
51
views
Subset by value in columnA and get the value in a columnC that corresponds to the maximum value row of columnB in R? Automate this using loop
The title is rather confusing (apologies), but I will try to explain it here.
I have a dataset with multiple names of individuals, the number of coffees they have had on a particular day of the week, ...
0
votes
0
answers
45
views
Unexpected search results: How does Gmail search interpret advanced queries, and how I can use that information to achieve precision?
Consider the following filter
Keep this filter (also provided in query form) in mind. We'll come back to it later.
from: { domain1 domain2 email1 email2 }
subject: { +"exact string 1" +"...
0
votes
0
answers
10
views
Common condition from two logic condition
I have two bit-level logic conditions which have some common inputs. I am looking for a way to identify a conditions which can make both logic condition as 1.
eg.
out1 = (a&b)|c;
out2 = (c|d)&...
-4
votes
1
answer
75
views
Conditional filter javascript (react) - combining two logical operators - || and && or && and &&
Basically in my react app I want to filter an array that meets 3 conditions, but if I use && (and) two times it doesn't work, only if I use || (or) and && (and) together.
Example of ...
1
vote
1
answer
65
views
Python Logical Operations as conditions in Pandas
I have a dataframe with columns:
import pandas as pd
import numpy as np
df = pd.DataFrame({
'A': [False, True, False, False, False, False, True, True, False, True],
'B': [True, False, False, ...
0
votes
0
answers
139
views
Why does it fail to detect WAVE or RIFF?
I'm trying to load a wav file into a C++ app
I Keep getting the program to print Invalid Wav File with exit code 5. This means the program thinks the chunkID didn't match RIFF or the format didn't ...
-1
votes
1
answer
21
views
sample query for review for improvement on big query
review the code and explain what is required to fix it.
new to sql and this is an review assigment. So trying to understand what is the logic being done
this is to be run on a big query platform
this ...