Questions tagged [boolean]

A Boolean data type is a data type with only two possible values: true or false.

Filter by
Sorted by
Tagged with
0 votes
1 answer
61 views

My method in Java return always true or false without what inside my if else [closed]

Im just start learning Java and I cant figure out what I do wrong in my method destroyEngine(). If you can help me I will very appreciate you. Thank you for your attention to my code. I tried replaced ...
Kucher Stanislav's user avatar
-3 votes
1 answer
36 views

Trouble creating a logical Boolean by using IF [closed]

How do I create a boolean with user input to compare the users input with certain numbered thresholds that would respond with different text for each threshold would be a different prescriptive ...
skylar Leakey's user avatar
0 votes
1 answer
65 views

`AndAssign`, `OrAssign` (`&&=`, `||=`) in Rust?

Does Rust have a short-circuiting AndAssign (OrAssign) operator &&= (||=), or something similar, for bool? These would desugar into: // x &&= y if x { x = y; } // x ||= y if !x { x = ...
BallpointBen's user avatar
  • 10.2k
-4 votes
0 answers
66 views

Java boolean. After run always true [closed]

This code is works fine. public boolean repair() { isReadyToDrive = true; return isReadyToDrive; } But from this code always condition is false. What I do wrong? public boolean destroyEngine()...
StanK's user avatar
  • 1
0 votes
3 answers
72 views

Looping a bool question and returning to main method

I'm trying to check an input is valid from a method call. I then need that method to receive input, confirm its either true or false. If false it loops and ask for the input again, if true it returns ...
Don Boss's user avatar
0 votes
3 answers
49 views

constantly getting the same error code no matter what i try

I've wrote a code to solve a problem for a course I'm doing. It looks good to me but keeps giving me the same error code. I've tried a few different ways and still get the same thing. This is the ...
Muhammad Yaseen's user avatar
-1 votes
1 answer
57 views

Declaring a boolean variable inside a if statement [closed]

I declared a variable called length inside a if statement which checks for length of a string. After that I tried to check length's value but got an error stating it is "not associated with any ...
Bharat's user avatar
  • 1
-1 votes
0 answers
39 views

Sitting or standing using a boolean expression [closed]

For a test review, I am asked to write some code that determines if someone is sitting or standing using a boolean expression. The following is what I'm supposed to do: isSitting() will return true ...
theking41's user avatar
-1 votes
1 answer
79 views

Weird cast from boolean to unsigned int makes final result wrong [closed]

We are using some assert functions inside a unit test framework that "implicitely" performs a cast inside the assert macro. Implicitely I say because the cast is not visible for programmer ...
embGangsta's user avatar
0 votes
0 answers
20 views

Recurring Boolean field in Redis json key value breaks document in index

I have this json document that i cant search for if i include the boolean field APurchaseNeed (as TAG) to the index. Its breaking when the field APurchaseNeed is present on two or more nodes in the ...
Nahoj's user avatar
  • 1
0 votes
1 answer
18 views

For Loop on Dictionary Values Returning Incorrect Bool Value

I'm learning to code in python and am trying to write a Tic Tac Toe game. I've used a function to assess if the game has been drawn (there should only be one instance where this is True - where all ...
C_b3al's user avatar
  • 1
0 votes
1 answer
41 views

Creating a check box with boolean value connected to API

I have a react application pulling data from an API that is an array of objects. One of the values is a boolean value and I am creating a check box that when clicked it changes the boolean value from ...
jSvSL's user avatar
  • 21
1 vote
1 answer
56 views

Ansible: How to conditional run if variable is stored in uppercase?

I am new to Ansible and try to run steps within an ansible-playbook on a conditional when clause. The variable is set up with an Oracle SQL and filled with only uppercase correctly. The check runs ...
uwe A's user avatar
  • 11
0 votes
3 answers
68 views

index/array troubleshooting : homework

this code: """this is a simple empty template in which to experiment""" menu = ['Spam', 'Eggs', 'Spam', 'Spam', 'Bacon', 'Spam'] def boring(meals): """...
hexicurse's user avatar
0 votes
0 answers
23 views

Why cant i use the autosave variable in the Following code? [duplicate]

The function works by looking at the string-value of the autosave and setting it to "yes" or "no". The programm itself seems that it wont reference to the variable. from tkinter ...
B3Crazy's user avatar
0 votes
2 answers
68 views

1<2<3 is true but reverse of this 3>2>1 is false, why? [duplicate]

I am new in programming and learning web development, when I was doing practice of Boolean data type in javascript I got a problem with this: Code: " console.log(1<2<3); console.log(3>2&...
Atomcode's user avatar
-2 votes
1 answer
49 views

How can I check if the user has entered a valid operand? (Python)

I'm writing code to implement a simple calculator in python. I'm attempting to check if a user has entered a valid operand. The code I entered is below. calc = False while calc == False: firstNum =...
Ant753's user avatar
  • 3
0 votes
1 answer
33 views

String values are not parsed correctly into boolean

Following code parses the string URL param 'verified=false' to boolean const verified = searchParams.get("verified"); const [message, setMessage] = useState(null); useEffect(() => {...
Dumindu Jayasekara's user avatar
0 votes
1 answer
31 views

"No matching signature found" error in python scipy ndimage.label() function used with boolean array

I have a boolean array to indicate dry days: dry_bool 0 False 1 False 2 False 3 False 4 False ... 15336 False 15337 False 15338 False 15339 False ...
claradenken's user avatar
0 votes
0 answers
52 views

Finding an operation that satisfies a specific requirement in "lean"

I have already define four boolean operations: def bnot : bool → bool | tt := ff | ff := tt def band : bool → bool → bool | tt b := b | ff b := ff def bor : bool → bool → bool | tt b := tt | ff ...
ANQI LIU's user avatar
2 votes
1 answer
33 views

why does the Kotlin boolean type extension function return different from I guess?

I'm a newbie and studying Kotlin. I think the below code should print true. but that actually prints false. I don't know why this code prints "false". Can anyone help me? fun Boolean.and(it: ...
Junbeom Jeon's user avatar
0 votes
0 answers
85 views

Distinguish bool from integers 0 and 1 in list

s = [0, 1, True] I have a list, I want to find True and access it. I know that False == 0, True == 1, is there really no way not to loop through it? print(s.index(True)) # output: 1 print(s.count(...
Тимофей Макаров's user avatar
0 votes
2 answers
122 views

How to convert JSValue to Boolean?

I'm doing an API call using TWebHttpRequest and then parsing the response string to a TJSObject, but when I try to get a value from the TJSObject, it comes back as a JSValue. I need to take this ...
Shaun Roselt's user avatar
-1 votes
0 answers
31 views

How to convert column into bool

I'm trying to make a scatterplot with pyspark, but it sends me an error. import seaborn as sns import pandas as pd from matplotlib import pyplot as plt from pyspark.sql.types import IntegerType from ...
Yunuen Alcocer's user avatar
0 votes
2 answers
43 views

Read a file to check for existence of multiple strings

I'm a SAS/Python person and I have to back-fill for a C# programmer . . . . I need to pre-process a file before it is read into my company's software to make sure it is the correct file type. The ...
User_zyp9's user avatar
0 votes
1 answer
44 views

problem dealing with a function based scenario

I'm doing a course to learn the basics of javascript I'm currently on the functions chapter and have no idea why my code doesnt work, I have even checked with chatGPT which says my code looks good and ...
Muhammad Yaseen's user avatar
0 votes
1 answer
23 views

R Shiny: non-equivalency between Boolean output values and output of checkboxInput

I'm in the process of building a Shiny app that includes a conditionalPanel(), triggered by a Boolean expression. In my final app, the hope is to have a password creation panel that will display for ...
jb802's user avatar
  • 1
1 vote
1 answer
57 views

Why does "some string" > 0 evaluate to TRUE in R? [duplicate]

Why does R evaluate "string" > 0 as TRUE? I first thought this might be due to an implicit type conversion or that R interprets this as nchar("string") > 0. This does not ...
Snoeren01's user avatar
  • 379
0 votes
2 answers
57 views

Why would a call to Thread.holdsLock() return false in a situation where it should return true?

I've got a Java program that features a main class that manages several identical daemon threads. The main class has a static ReentrantLock that the daemon threads access. The main class creates the ...
Zac's user avatar
  • 11
1 vote
1 answer
56 views

How can I turn condition back to False without breaking this code?

I'm working with this Hangman game and this part is for keeping track of the player's lives. It pulls a random word from a list, then it takes the word and turns it into blanks (_). If you guess right,...
Feeko's user avatar
  • 13
0 votes
1 answer
45 views

Why does prettier add an extra pair of parentheses here?

I was trying to format a block of code like this one: let [a, b] = [64n, 2n]; do { console.log(a); } while (a /= b); I found that prettier adds an extra pair of parentheses around the while ...
Mr. X's user avatar
  • 708
-1 votes
1 answer
76 views

How is boolean xx = (43.3L == 3.333f) syntactically correct

I'm have a problem with understanding this question about syntax it says the answer is boolean xx = (43.3L == 3.333f); but i don't understand how it is Which of the following Java statements are NOT ...
Edward lucas's user avatar
0 votes
0 answers
42 views

Validating inputs for a 2D- Character Array

I have some code that I am working on, and I am stuck. How do I check a 2D character array for correct character(s) input? I am simulating a tic-tac-toe game, and only want 'x' and 'o' for my inputs, ...
Adrian Pena's user avatar
0 votes
1 answer
45 views

Angular button toggle to change body background using Hostbinding

I have a page with a toggle button, which I need to change background colour of the page and all child components as well. How can I acheive this? Is it possible to do using HostBinding, if yes, how? ...
user17449555's user avatar
0 votes
0 answers
26 views

Google Sheets ARRAYFORMULA help; IF x=TRUE then do not add and so, IF false add to the worksheet

I have five worksheets in one workbook. In one worksheet I am trying to get a formula to reflect this logic: In Worksheet2 if the values in column B2:B are TRUE (Y/N Boolean) then do not include them ...
DEFCON Dragon's user avatar
-1 votes
1 answer
56 views

if function not returning result as expected [closed]

I'm trying to add a 'Yes' in respective column if a certain string is found in a subject column: i.e. if 'visual' is found in the entry of the column Description, it should return a 'Yes' in the '...
Rayily's user avatar
  • 3
0 votes
0 answers
27 views

rust z3 version >= v 0.10.0 ast.Bool::and function

Rust z3 When the version of z3 is "v.0.4.0", we could use Bool::and function to represents the result of the AND of two bool variables. But in version >= "v.0.10.0",it went ...
ArkaWang's user avatar
0 votes
0 answers
37 views

How to turn a dask scalar of type boolean into a boolean expression

I have a long code with many data manipulations in which at the end of it I want to get a boolean expression from comparing two dask series, this is the final part of my code: ...
Mika Bell's user avatar
0 votes
1 answer
31 views

EXCEPTION CAUGHT BY WIDGETS LIBRARY The following _TypeError was thrown: ): type 'Null' is not a subtype of type 'bool'

I'm getting error. i want to update time after time being selected. as i'm new to flutter i'm unable to understand the flutter. I'm leaving pages that i've worked. Main.dart import 'package:flutter/...
Abdur Rahat Tarek's user avatar
0 votes
0 answers
8 views

boolean values to numeric values in R

I'm trying to convert the Awesomness column from a logic to numeric type. When I filter the column I seem to get the output TRUE/FALSE/NA. I've played around with the function as.numeric without luck. ...
Jesper 's user avatar
0 votes
1 answer
41 views

The boolean values in shared preferences doesn't reflect on UI Flutter

I'm working on a todo app where two of the functions are mark and unmark the todo item as done. It works normally onPressed and the isDone value is saved in shared preferences too, but when i reopen ...
eqrakhattak's user avatar
0 votes
1 answer
27 views

How to Apply IF function to text response and a number response?

In one column I have their response (Drove alone, bus, bike...). In the next column, I am giving a 0 if they drove alone and a 1 if they took any other mode. The problem is that there are also ...
Calvin's user avatar
  • 1
3 votes
1 answer
63 views

Test-Path -Path behaviour with array of paths

I'm trying to check if multiple files/folders exist. The Test-Path parameter -Path accepts a [string[]] array. Please see example code: $arr = @( "C:\a\fake\path\test1.txt", "C:\...
Jelphy's user avatar
  • 1,015
0 votes
0 answers
18 views

Is it possible to use boolean in an animationDrawable in android studio?

I have a project where i have two images in loop in a AnimationDrawable, and i would like to use a single button that play a specific sound for the image that is on screen, for example: when image 1 ...
Leleo's user avatar
  • 1
-4 votes
1 answer
99 views

How do I make a boolean variable that is true if it is divisible by any odd number greater than 1 (including possibly itself), and false otherwise? [closed]

I need to create a boolean variable called hasOddFactor that is true if num is divisible by any odd number greater than 1 (including possibly itself), and false otherwise. The current code that I can ...
Sheebs's user avatar
  • 15
1 vote
1 answer
54 views

Pandas: How to avoid FutureWarning when setting bool value to NaN (missing)?

I want to apply comparison operator to Pandas DataFrame. In case the source data value is missing then my result bool table should contain missing values as well. My code: >>> pd.__version__ '...
Karel Marik's user avatar
-2 votes
1 answer
82 views

Fonction skip bool and doesn't calculate [duplicate]

Welcome in my misery. I'm a novice/beginner in coding :) I've been trying to write a calculator that detects anomalies in the input provided. My first problem was to neglect any letters and that was ...
TheAX 0198's user avatar
-3 votes
1 answer
59 views

Python Boolean returning empty

why is this code not doing what i want it to do? i want a simple True\False output but it keeps returning empty no matter how i write it. what am i doing wrong here?? tried: yes = "True" no =...
DoesNotMatter's user avatar
0 votes
0 answers
49 views

How does Python compare strings of different length? [duplicate]

For example suppose I run "12"<"7" , the answer is TRUE. Why?
Alex's user avatar
  • 141
-1 votes
3 answers
79 views

Can I use CompareTo in a boolean function?

I want to sort city names alphabetically, so I'm using CompareTo to compare city names to sort them. But the CompareTo is giving me an Int and the && isn't liking that. Also, a note - I am not ...
Denali Therrien's user avatar

1
2 3 4 5
235