Questions tagged [boolean]
A Boolean data type is a data type with only two possible values: true or false.
boolean
11,774
questions
0
votes
0
answers
5
views
Using boolean difference in Pyvista gives artefacts
I am trying to do a boolean difference between two different shapes (a larger cylinder and a smaller cylinder that's deformed).
The reasons is I want to use this geometry input for a simulation later ...
0
votes
0
answers
6
views
Coding and Plotting Haar Wavelet
I am trying to plot Haar Wavelet function using the code below:
#define the t variable
#define the range of the time domain
L = 10
#Define the number of points in the time domain
n = 100
#define the ...
1
vote
1
answer
23
views
How to resolve complex boolean expressions into all possible combinations
I'm trying to solve the following problem. I have a set of logical operations and I would like to resolve them into all possible combinations. For example:
"((A | X) & B & C) | (C | E) &...
1
vote
0
answers
21
views
Opposite results between `bool(x)` and `x.__bool__()` after patching
In this simple little test case, I monkey patch the __bool__ method of an instance, but am surprised to see that calling bool(x) and x.__bool__() give opposite results afterwards. What is the ...
0
votes
0
answers
56
views
Convert undefined state (x) to high impendance state (z)
I have this set and reset test bench:
module sr_tb;
reg s = 0;
reg r = 0;
wire p;
wire q;
wire y;
or or1(y, s, p);
not not1(q, r);
and ...
0
votes
0
answers
13
views
Support for complex queries using analyzers
I submitted this as a feature request but perhaps it is best for this to be addressed as a question here.
We have the need to be able to build some more complex search queries that logically combine ...
-1
votes
0
answers
43
views
I have this error: Trying to access array offset on value of type bool
Warning: Trying to access array offset on value of type bool in C:\xampp\htdocs\streaming\includes\classes\Video.php on line 27
Warning: Trying to access array offset on value of type bool in C:\xampp\...
0
votes
1
answer
103
views
What's wrong with this simple boolean expression in Ruby?
Here is my Ruby 3.2 code:
puts (1 and 0)
puts (1 and 0 and 1)
It prints 0 and then 1 (I'm expecting 0 in both cases). Can someone explain, why?
0
votes
1
answer
56
views
Sending data from Rails to get validated in JSON Schema
In my app I am sending product information in various types (string, integer, float, and boolean) for validation by a JSON Schema.
I noticed today when attempting to send false boolean values for ...
1
vote
1
answer
67
views
How to redirect a user after a boolean check in Flutter
I have a button that checks the time difference, so I would want the user to be redirected if the button is active or when he clicks on the button when it is active. Below is what I have tried but I'm ...
0
votes
1
answer
50
views
How can I make a bool happen only once?
I'm trying to set up a dialogue system and I can't figure out how to make it stop repeating every frame.
{
[SerializeField] public TMP_Text dialogueText;
[SerializeField] public GameObject ...
0
votes
1
answer
29
views
Check if child exist in firebase database and return true or false [duplicate]
I want to create method that will check if a child is present or not in firebase database and returns the value true or false accordingly. here's my code
public boolean check_if_child_exist(...
0
votes
2
answers
24
views
Google Sheets - formula for multiple values from different columns are fulfilled
I need to find a formula that can tell me if certain conditions are met in multiple columns.
I have Column A "Day of Week" and Column B "24 Hr Clock"
In column C I would like to ...
0
votes
0
answers
25
views
Aligning Sparse Boolean Arrays
I have two (very) long and sparse boolean arrays n1 and n2, representing spikes of two neurons that are responding to the same stimulus. Because they are responding to the same stimulus, they have ...
0
votes
1
answer
31
views
gdstk Boolean too slow but works fast in Klayout?
I am trying to cut out several holes in a rectangle. When I do this in Klayout using "Subtract others from first", the result is computed almost instantly. However, when I try to do it using ...
1
vote
1
answer
34
views
Bool not becoming false in Unity
I am trying to create a working attack animation for a 2D game that's for a school project. I noticed that the attack animation continuosly loops with the idle animation. The attack animation stops ...
2
votes
3
answers
212
views
Checking for False when variable can also be None or True
Update: please see my discussion if you want to delve further into this topic! Thank you everyone for your feedback on this!
I have a boolean(ish) flag that can be True or False, with None as an ...
1
vote
1
answer
35
views
Unity C# script not working i used a bool function to disable / enable my movement script
The input escape key cancel function works but the bool function I added to determine if the key is being pressed twice to enable / disable player movement for my menu ui. does not.
Any ideas?
Does ...
10
votes
2
answers
323
views
Boolean addition in R data frame produces a boolean instead of an integer
If I try to create a new column in an R dataframe by adding 3 boolean expressions in one step, it results in a boolean rather than an integer. If I use an intermediate step to first create columns for ...
0
votes
2
answers
45
views
Modify parent component output based on boolean value set in child component in Angular
I'm new to Angular and need help on how to best deal with a situation using Angular 16.
Basically I have two components for two different versions of our site header, one is the default and the other ...
2
votes
0
answers
18
views
Boolean not changing across all instances of a script
I'm creating a script for a turn-based battle system.
private void OnMouseDown()
{
if(inBattle == true && battleStart == true)
{
if (renderer.tag == "...
0
votes
2
answers
39
views
Coding in R. How do I select based on if a Boolean is true for a row when the the Boolean needs to check across multiple columns?
My data set looks something like this:
Movie Name
Action
Thriller
Horror
MovieBudget
Movie1
0
1
1
2500000
Movie2
1
0
0
3430000
Movie3
1
0
1
1240000
I am trying to find which genre has the highest ...
0
votes
1
answer
33
views
Python merge/join/concat with boolean condition
I would translate this SQL code (see below) in python code. I think I can use pandas.merge/join but I don't know how define the boolean condition.
create table gg as
select b.*, a.value
from table b ...
0
votes
0
answers
46
views
How do I find a duplicate in a Java array? [duplicate]
public class Unidad_6 {
public static void main(String[] args){
Scanner entrada = new Scanner(System.in);
boolean dupl = false;
int arreglo[] = new int[5];
for(...
1
vote
0
answers
38
views
How to check if a user's answer is valid and re ask the question if it is not in javascript?
I am making a choose your own adventure story game and I am trying to take a user's input and see whether they typed "n" or "y" and if they didn't re-ask the question. Currently, ...
0
votes
0
answers
44
views
How to add eventlistener to created buttons? [duplicate]
I'm making a todo list that includes a check button on every todo, but I don't know exactly how to add an event listener so that every button when clicked changes only that specific button's color (...
1
vote
2
answers
108
views
How correctly memset array of bool
I have bool array and I want initialize all elements to false. What is the correct way using memset. I see these examples on stackoverflow:
bool arr[10];
memset(arr,0,sizeof(arr));
and
bool arr[10];
...
1
vote
1
answer
48
views
Proving NOT TRUE in Lambda Calculus
FALSE = λxy.y
TRUE = λxy.x
We can define the NOT operation as follows:
NOT = λx.x FALSE TRUE
I can prove NOT FALSE by doing this:
`NOT FALSE = λx.x (λxy.y) (λxy.x) (λxy.y)
- x = x
- M = x (λxy.y) (...
0
votes
1
answer
115
views
Pandas Boolean Conditioning
If i have a boolean pandas column, how can i make every True value to be followed by at least 2 False values? Is it possible to make the 2 into a variable so that i can adjust this to be any integer? ...
6
votes
1
answer
83
views
Can a Range evaluate to False in Bool context in Raku?
While making use of a Range to solve a problem I noticed that a Range with 0 elems would be True as a Bool. In what scenarios could a Range be False?
[0] > (^0).so
True
[1] > (1..0).so
True
0
votes
0
answers
22
views
ngx-capture library not fully loaded for the first time
I am using ngx-capture library where it is not loading properly for the first time
but the subsequent time it works fine.
@if (freeze) {
<ngx-capture #ngxCapture [target]="screen" (...
0
votes
2
answers
75
views
My for-loop (in c language) is not looping in vscode
In my code below, I'm trying to check whether each char in the string array is alphabetical or not by creating a bool function. But when I run the program, my bool function is not looping through the ...
1
vote
2
answers
42
views
Boolean times integer - anyone care to explain this gotcha? [closed]
I was surprised to realize that the result of multiplying a boolean by an integer depends on whether the boolean is a literal. A rare gotcha? It certainly got me.
Bonus points: where is this ...
0
votes
1
answer
48
views
Pandas counting the amount of True/False values in one column for a unique set/grouping of another column
I am trying to count and list unique values in a column based on another column's as long as the unique count is greater than 2. I was referencing this post, which has got me partially there, but need ...
1
vote
0
answers
43
views
How can I access controls of form in another form
I'm working in a windows form application. I have two forms; in form A I have two picture box and in form B, I have a button. I want form B to show a message when I click on picturebox2 in form A and ...
0
votes
4
answers
69
views
How to pass bool value from one class to another class in flutter
I need to pass the value isBottomBarVisible from Class A to Class B. If isBottomBarVisible is true, then align it to the top center; otherwise, align it to the center in Flutter.
class ClassA extends ...
0
votes
6
answers
84
views
How to change variable inside a method
I'm new at programming android apps.
How can I change a variable (bool) inside a button-method (or any method)
Here is just an example:
package com.example.test1;
import androidx.annotation.NonNull;
...
0
votes
0
answers
28
views
Is it possible to prevent implicit bool <-> int conversions? [duplicate]
Given this code:
void foo(int bar, bool stuff)
{
}
enum class Mode
{
SomeMode_1, SomeMode_2,
};
void foo2(int bar, Mode stuff)
{
}
int main()
{
foo(1, true); // (1) compiles as ...
0
votes
1
answer
18
views
Why is $scope >= 0 showing true in interpolation while empty in controller?
I'm setting a $scope variable to 0 or 1 based on a successful action and showing elements with ng-show. I'm resetting the $scope variable to empty when the step is finished. However, I have discovered ...
0
votes
3
answers
102
views
Is there a shorthand way to say if a bool is already true don't assign false?
I already tried to search for this and couldn't find anything and not sure what this would be called. Boolean coalesce?
I have several methods being called in parallel each returns a bool indicating ...
1
vote
3
answers
83
views
return a bool value from a Future<bool> function in flutter
My Question is a bit similar to How can I get my bool value out of a future<bool>? but i couldn't get an aswer to my question from it. I have the function in a seperate file because i also want ...
1
vote
3
answers
135
views
java List with all combinations of 8 booleans
Let's say I pass in 3 trues and 5 falses, how can I code the getAllCombos method to return a List that includes:
A 1 SampleForSO object with the 3 chosen
The 3 "Three Choose Two" ...
0
votes
1
answer
34
views
Ternary Operator not displaying row when condition is false but displays when true
I usually don't post on here but I've been scratching my head at this for a couple days now. I have a tabbed table that's suppose to display applicants that have been accepted in one and applicants ...
2
votes
2
answers
111
views
How is this (xy)' + (yz) simplified into this (x’+y’)+z in boolean algebra?
I not understand how the first Boolean expression on the question can be simplified into the last. Please help me.
My attempt:
1. (xy)' + (yz)
2. (x' + y') + (yz) # Using de Morgan's law.
3. x' + (y' +...
0
votes
1
answer
35
views
Octave: Boolean AND returns wrong number
I am trying for several hours to calculate a boolean AND operation in Octave.
It return a wrong number.
I want to calculate following numbers:
result = 4037 & 63
result should be 5 but i get 1.
I ...
0
votes
1
answer
53
views
Azure Dev Ops: How can I require a boolean field to be true before state can be changed?
I am modifying a workitem using the XML model on Azure Dev Ops server 2022.
I have a short checklist, made up of checkboxes, like
x Independent
x Negotible
x Valuable
x Estimable
x Small
x Testable
...
0
votes
1
answer
57
views
truth value of empty user-defined data objects [duplicate]
This is more of a philosophical question.
In python, bool([]) evaluates to False.
On the other hand, consider the following:
from dataclasses import dataclass
@dataclass
class Lists:
items: list[...
0
votes
2
answers
75
views
In python, 13 and 9 = what? [duplicate]
Boolean operator 'and' returns True if both sides are True. Any number other than 0 is True. So python should return True for
13 and 19
But why does it return 19?
2
votes
4
answers
137
views
The difference between (x^y) and !(!(x^y))
I am a new computer science undergrad. For my assignment I need to implement isNotEqual(int x, int y) function in C by just using bitwise operators. This function will return false if x and y are ...
0
votes
4
answers
121
views
Iterating through all possible Boolean values
I have a function like this:
fun foo(a: Boolean, b: Boolean, c: Boolean) { /*...*/ }
and I wanted to test it with all possible argument values:
for (a in false..true)
for (b in false..true)
...