Most voted "boolean" questions
A boolean expresses a value that can be either TRUE or FALSE(both case-insensitive). It is the type of data, of the simplest existing, occupying 1 bit of storage. It is used in logical operations such as conjunction, disjunction, exclusive disjunction, logical equivalence, and negation, which correspond to some of the operations of Boolean algebra, developed by mathematician George Boole.
Learn more…63 questions
Sort by count of
-
29
votes2
answers11436
viewsWhat is the difference between Boolean and Boolean?
I performed some tests using Boolean and boolean and apparently returned the same result. See below: Boolean bool = true; boolean bool2 = true; if(bool) Log.wtf(TAG, "Funciona!"); if(bool2)…
-
28
votes6
answers1694
viewsWhy not use a Boolean parameter?
I’ve seen in some places you shouldn’t wear something like this: int teste(object obj, bool especial) { ... } There within the function some operation will be done or not, depending on what you…
function encoding-style software-engineering parameters booleanasked 7 years, 7 months ago Maniero 444,682 -
10
votes2
answers188
viewsBoolean arguments, in general, are not good?
I was reading a little bit of Clean Code. The book talks about "good programming practices", and on the Internet, in one of the slides it is said that: Boolean arguments, in general, are not good. I…
encoding-style language-independent boolean argumentasked 7 years, 3 months ago UzumakiArtanis 9,534 -
10
votes2
answers217
viewsWhy does this if check "if it’s ! false" instead of "if it’s true"?
I came across this piece of code: function showPrimes(n) { for (let i = 2; i < n; i++) { if (!isPrime(i)) continue; alert(i); // a prime } } function isPrime(n) { for (let i = 2; i < n; i++) {…
-
8
votes1
answer2417
viewsSimulate boolean type in C
What is the most appropriate way to simulate the type bool in C? My teacher did it in a very simple way. #define bool int But I also found an excellent answer here (follows a copy of the code). //…
-
8
votes3
answers374
views"== true" is useful for something? Is it better "!" or "== false"?
Place == true is useful in checking, or is completely useless? You better use ! or == false. Example: if (pessoa.estaMorta() == false) .... if (!pessoa.estaMorta()) .... if (pessoa.estaViva() ==…
-
7
votes2
answers227
viewsHow to convert byte to Boolean[8] and convert back?
I need to record some booleans in a File, and then retrieve them. I can record and read one or more bytes with the Classes java.io.FileInputStream and java.io.FileOutputStream, so I need to convert…
-
7
votes1
answer88
viewsCan qubit be represented in Boolean?
A bit can have only two states: true and false. In quantum computing, the qubit, or quantum bit, in which you can assume true and false simultaneously. How this is represented in boolean form? Or…
-
7
votes2
answers1109
viewsDo if by denying a boolean in Python
How do I make for the if check a boolean negation, as below: self.senha = Gugu_0099 for i in self.senha: if i.isdigit() and i.isalpha(): total_simbolos += 1 I want you to get into this if if the…
-
7
votes3
answers229
viewsHas Javascript changed its rules about what is false or true?
It occurred to me in the part about booleans, the following problem. I have this variable: var name = "10kg" / 10; if (name) { console.log(name); } else { console.log("Not exist"); } The same should…
-
5
votes2
answers4989
viewsWhat is a boolean?
What exactly is Boolean? Could you give practical examples? It makes a difference to write true or True?
-
4
votes1
answer179
viewsProblem with boolean checks in Javascript
var a = '0'; if (!a) console.log('false'); if (a == false) console.log('false 2'); Why the false is not displayed but the false 2 is?
-
4
votes2
answers569
viewsReturn Datareader to bool field
I need to return a field that is of the type bool: public List<TB_USUARIO> ListarTodos() { var strQuery = "select * from tb_usuario"; using (contexto = new Contexto()) { var retornoDataReader…
-
4
votes2
answers1567
viewsError declaration null - Unknown type name bool
The error you are making is in this function. bool tem_numero_na_lista(tipo_lista * aux, int valor) { while (aux - > prox != NULL) { if (aux - > info == valor) { return true; } aux = aux -…
-
4
votes1
answer252
viewsIs there a name for "3-state Boolean"?
But as such a "Boolean of 3 states"? It is usually used in comparing dates, where possible results are -1, 0, 1. I was in a similar situation and I was left with this doubt when I wanted to ask my…
-
4
votes5
answers3692
viewscreate "contain" function that says if an array contains a certain element and returns true
I tried several ways with the indexOf (is a requirement of the issue use), but I’m having a lot of difficulty because I’m learning everything over the internet. The code I’m trying to use does the…
-
3
votes2
answers1732
viewsWhy does if only work with the return of a method?
Follow my code that contains a boolean method: import java.util.Scanner; public class ativ16 { public static void main(String[] args) { int n, i, v[]; Scanner entrada = new Scanner(System.in); n =…
-
3
votes1
answer60
viewsWhy are boolean values converted to string in the case Camel in C#?
Today I came across a peculiarity of C# which I had never stopped to pay attention to: When converting a value bool for string, the result is a text in Camel case: string verdadeiro =…
-
3
votes1
answer83
viewsWhy use "is" at variable start in Kotlin?
What is the reason for using the is in front of the variable. Example source code. I know it has something to do with the set. class Rectangle( val height: Int, val width:Int) { val IsSquare:…
-
3
votes2
answers469
views(~ABC)+(A~B~C)+(AB~C)+(ABC)
I’m trying to solve this formula: (~ABC)+(A~B~C)+(AB~C)+(ABC) (~ABC)+(A~B~C)+AB (~ABC)+A(B+~B~C) But I don’t know how to get out of this last part. I know that the end result has to be a~c + bc. But…
-
3
votes2
answers512
viewsHow to simplify the if command in python?
Is there any way I can simplify this line of code in Python: if X = 1 or X = 2 or X = 3 or X = 4: I was trying this way: if X = {1 or 2 or 3 or 4}: But trying like that makes a mistake.…
-
2
votes1
answer113
viewsWCF out bool parameter
I created a Webservice WCF, and at the interface IService1.cs I put the signature of the methods [ServiceContract] public interface IService1 { [OperationContract] bool insertConsulta(BConsulta…
-
2
votes4
answers258
viewsHow is this operator not working in this code?
Code: var i = 0, finished = false; while( (i < acentos.length) && !finished){ Question: I have a variable bool receiving false, and in my while I am denying her. If I’m denying a false…
javascript operators logic boolean logical-operatorasked 7 years, 4 months ago Nicolas Guilherme Matheus 502 -
2
votes1
answer346
viewsArray of Boolean for Integer
How can I transform a Boolean array, boolean[] bits in his Integer correspondent? I have a function that does exactly the opposite, but I didn’t understand it enough to be able to reverse it. int…
-
2
votes1
answer506
viewsWhen to use And, Andalso and Or, Orelse?
I don’t know when to use the syntax Or or OrElse and/or And or AndAlso, because I don’t understand what difference it makes in the logic circuit. Being in C#, And = &, AndAlso = && and…
-
2
votes1
answer111
viewsWhy don’t booleans have a common class in Ruby?
Ruby doesn’t have a class Boolean. I realized that boolean objects are of specific classes depending on the value, see: true.class => TrueClass false.class => FalseClass Different from other…
-
2
votes1
answer355
viewsClick the Save button and change boolean Django 2.0
Gentlemen, I’m studying Django 2.0, and I’m having a problem, by clicking save I want to change the boolean database of False for True, and I have no idea how to do that. If anyone can help me?…
-
2
votes1
answer109
viewsProblems with 2 vectors joining
I have a problem joining two sets of integer numbers into one vector, without repeating numbers that are in Set A and Set B. The following error is shown in row 13: error: Unknown type name ?bool';…
-
2
votes2
answers74
viewsDifferences of boolean return
I came across the following example: $umidade = 91; $vai_chover = ($umidade > 90); if ($vai_chover) { echo "vai chover"; } To $vai_chover returns a boolean in if, but I found too much code to do…
-
1
votes2
answers908
viewsIndication of the first negative number of a vector
I have to make a program in C that saves the Inudice from the first negative number, but I’m not able to do it. The question is this down below: Prepare a program in C that enters 5 integers in an A…
-
1
votes1
answer151
viewsWhat’s wrong with the logic of this Python code?
x = bool(input("True or False...? ")) if x == 'True': print("Você escollheu True") else: print("Você escolheu False") What’s wrong with this logic, more specifically about logic involving the…
-
1
votes2
answers126
viewsRelease of exceptions as a function of prime number
Write a function that receives a number, throw an exception if the number is not positive and return true if it is prime, or false, otherwise. My answer: public static void main(String []args)…
-
1
votes1
answer131
viewsConvert strings to boolean
I’m dynamically adding one javascript and its src need to pass some parameters... the following function creates this "querystring": var querystring = {a:'b',b:true,c:'d',e:false}; var query =…
-
1
votes1
answer584
viewsHow do I get back a Boolean after a form.Ubmit?
I have a customer registration form that runs Submit on the sign up button: document.getElementById("formularioCadastro").submit(); everything ok, the registration works, but I wanted to return a…
-
1
votes2
answers76
viewsSimplification of boolean function
I arrived in a boolean function and I wonder if there is a simpler form or if mine is right. The function is: I arrived at the following reply: I’m wondering if this is the simplest solution I could…
-
1
votes1
answer434
viewsHow to convert an object to Boolean in Ruby?
Ruby objects have some methods for representation in another type, such as: to_s: convert to string to_a: convert to array to_i: convert to whole to_f: convert to float But there is no standard…
-
1
votes1
answer102
viewsHow does Python determine if a value is true?
I have the following doubt: >>> a = [200,100] >>> a[True] Exit >>> 100 >>> a = [200,100] >>> a[False] Exit >>> 200 Why does this happen? The…
-
1
votes1
answer41
viewsHow to check an Imagepattern of a Rectangle in Javafx?
I’m trying to check in this method if my Square, which inherits from Rectangle, was filled with an Imagepattern through the getFill function(): public boolean HouseIsValid(House Square) { return…
-
1
votes2
answers245
views -
1
votes1
answer2505
viewsChange attribute of an object array in the state in the application
to try to make an attribute of one of the objects in an array of objects switch between true and false follows code: Initial state: constructor(props) { super(props) this.state = { post: [{ nome:…
-
1
votes10
answers5627
viewsFunction that returns if one can go to the database with true/false?
EXERCISE: Set the function possibleIrAoBanco, take two parameters, the first is diaDaSemana (string) and the second horaAtual(number), the function must return true, only if the database is open.…
-
1
votes2
answers73
viewsError in a function that returns an AND of two variables in python
I made a function in Python that in theory should return a and of each element of two variables, however the result is not being expected. The answer would be [0, 1, 0, 0, 1, 1, 0, 0], but is…
-
1
votes1
answer110
viewsStore multiple boolean states in only one bool variable
The guy bool so much at C as in C++ consumes at least 1 byte of memory to be stored, I saw that this is because it needs to be addressed or something. So, it would be like this 1 byte to store more…
-
1
votes1
answer103
viewsReturn true when Bigdecimal variable is different from null, otherwise return false
I have a type attribute BigDecimal x. I need to call a method exampleMethod(). I would like to pass the parameter true or false depending on whether x is null or not, as in the example below: val x:…
-
0
votes0
answers47
viewsProblem in method verification
I did this function for the game of old: void jogadaPC(char m[][3], char opc) { puts("\nVez do computador."); sleep(1); int linha = rand() % 2; int coluna = rand() % 2; bool vazio = localVazio(m,…
-
0
votes1
answer1501
viewsHow to use Boolean in Json
I have the following JSON, and within my code I have a check to see if autoLogin is enabled. Object {autoLogin: "true", autoLoginKey:…
-
0
votes0
answers229
viewsPHP bool Expression
I am working on a Boolean expression configured by the application user. This expression comes from the database so it’s a string, I need to make PHP understand it so I have true and false. Example…
-
0
votes2
answers69
viewsProgram with boolean expressions enters the if block every time
prefixes = "JKLMNOPQ" suffix = "ack" for letter in prefixes: if letter[0] == "Q"or"O": print(letter+"uack") continue print(letter+suffix) Expected response: Jack Kack Lack Mack Nack Ouack Pack Quack…
-
0
votes2
answers569
viewsReturn False or True
I need to know if the second number is multiple of the first number, if yes return true otherwise false, I’m having trouble declaring the library Boolean. package br.fatec.com; import…
-
0
votes0
answers106
viewsCreate a Boolean column in Oracle Database
In an oracle bank I have to create a column with the Boolean type ALTER TABLE dbamv.prepad ADD editable BOOLEAN default FALSE; But the database displayed an error message: ORA-00902: invalid data…