The Boolean data type represents simple True or False values.
-2
votes
0answers
11 views
Conditionals with booleans and functions
In this image the conditionals are boolean, right?
Could they be the 0/1 return value of a boolean function where the function is in parantheses?
if(visible)
is the same as
if(visible())
...
0
votes
1answer
35 views
Scala - Booleans - & vs &&, | vs ||
I just noticed that in Scala Boolean supports both & and &&. Is there a difference between these two operators? The Scala docs use the exact same description for both of them, so I wasn't ...
1
vote
3answers
33 views
Comprehension difficulties regarding Boolean operators and whileloop
I am working on "Learn Python the hard way" and have a little understanding question regarding while loops and boolean operators.
def bear_room():
print "There is a bear here."
print "The ...
0
votes
1answer
53 views
c++ captured reference to bool wrong value
I capture local bool value by reference to lambda and the first time it gets captured the value is unassigned (some random value). Why?
bool singleConfirmed=false;
...
0
votes
7answers
43 views
Why does junit say my boolean test should be void?
I've searched on google and clicked link after link on many different sites and none of the available answers helped me. This is unfortunate since some of the sites reference the same answer, which I ...
0
votes
0answers
49 views
Java boolean methods and word algorithims
I'm trying to understand the below question. I kind of know what the method is doing, and it returns True. Also, I don't understand the question. I believe the answer is 2, but I don't know why. Below ...
-1
votes
1answer
48 views
Json value deserializing incorrectly for bool C#
For some reason, my deserializer is setting the object as false, even though its value is true in the document. Everything else works perfectly except for this boolean value. Any ideas how I can fix ...
-1
votes
3answers
40 views
Not all control paths return a value for Boolean?
// I'm using a boolean function and it returns a false and true, but the main isn't //picking it up. The my_string.Is_full and my_string.Is_empty are suppose to say "it is not //full" and "it is ...
0
votes
3answers
60 views
My do-while statement doesn't seem to work
I'm completely new to coding and I was wondering if you guys can help me. This is part of a code in which you battle a vampire, RPG style. My program does not loop back to my characters turn after I ...
0
votes
1answer
26 views
Reading boolean Variables from a File
The program I am currently working on is supposed to use input read in from a file to create a series of triangles. The information in the file is 3 sides of type double, color of type String, and ...
1
vote
4answers
63 views
Simplify several boolean conditions java [duplicate]
how would you simplify all these conditions?
String s = "The wold is big"
if(s.contains("is") || s.contains("are") || s.contains("was") || s.contains("were"))
{
return s;
}
Since I have to ...
0
votes
2answers
39 views
XSLT recursive boolean condition
I have a scenario where I use recursion to verify if a condition is true or false in a set of elements, when the condition for any element becomes false the whole condition is false.
I have used ...
-1
votes
2answers
37 views
Observe a BOOL change in another ViewController
In vc1 im setting a BOOL [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"myKey"];
In vc2 I want to observe if this BOOl changes [[NSUserDefaults standardUserDefaults] boolForKey:@"myKey"]
...
1
vote
1answer
96 views
Quine–McCluskey algorithm in haskell
I found the Quine–McCluskey algorithm implemented in Haskell, but I don't know what I have to do to load it in GHCi.
Can someone help me out?
...
0
votes
1answer
27 views
Please explain the use of usedNums[newNum] = true; in the following code
The code below generates the unique random number for bingo card.
The each cell of the HTML table has IDs as square0,square1...square23
I understand the code, except the part below.
"usedNums[newNum] ...
0
votes
1answer
22 views
Rails Sunspot Search by boolean name
I'm using Sunspot Search with Rails 4 and it's been working great, there's only one thing I haven't been able to figure out, and after days of banging my head against the wall I decided to ask here.
...
-1
votes
0answers
16 views
mysql_num_rows() expects parameter 1 to be resource, boolean given in … on line 84 That information is incorrect, try again [duplicate]
Hey I'm following a PHP tutorial on YouTube. Everything has been going fine until now, I keep getting this whenever I try login: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...
-5
votes
4answers
52 views
Comparing a char with multiple characters
for(int j=0;j<str.length();j++){
if(char[j]==(a||e||i||o||u))
count++;
}
I know the result of (a||e||i||o||u) is a Boolean so can't compare but how can we check ...
0
votes
1answer
19 views
Using PHP to measure and alter MySQL fields but changes are incorrectly stored/displayed
The concept of my game relies on the fact that if you do not log in to take care of your pet, the pet will 'die'. Currently this is my code to measure the time past and to apply the negative modifiers ...
-1
votes
2answers
36 views
How to save a checkbox checked state as a boolean?
How to save a checkbox checked state as a boolean?
ASP.NET
<asp:CheckBox ID="cb" runat="Server" />
VB
Dim cb As Boolean = cb.Checked
The above code produces the following error:
...
3
votes
5answers
70 views
Utility method to convert Boolean into boolean and handle null in Java
Is there a utility method in Java which converts Boolean into boolean and automatically handles null reference to Boolean as false?
1
vote
4answers
32 views
Is there a convenient way to check if at least a certain number of conditions are true?
Is there an easy way to check if a minimum number of conditions have been met? Like, let's say that I've asked somebody to pick at least 4 days of the week. Is there some sort of way that I can check ...
0
votes
0answers
32 views
C - AVR - char/boolean value has changed (up-down-trigger) - best practice
Is there a better way, best practice, uses less resources etc.. than shown below to preform a trigger for the up and down of a Boolean value in AVR C programming?
#define bitstate(sfr,bit) ((sfr) ...
-1
votes
1answer
32 views
Java make program check if a word is in the dictionary
I want this program to check if a word is in the dictionary how would I do this in a format close to this? What should I add to this to make it work? Here is my code: ...
0
votes
1answer
20 views
Rails how can i show only enable clients
i I have 2 controllers client and sales what i need to show in my select options only clients where enable = true in my conttroler sales? enable is a boolean.
now in my new.html.slim in view SALES ...
5
votes
4answers
77 views
Is setting a boolean to false redundant?
I have read several previously asked questions and answers on this topic [or quite similar], but none of them have really addressed this point-blank. When declaring a new boolean varibale, is it ...
-2
votes
1answer
36 views
IRB console and rails application evaluates 'or' differently
In my attempts to write code with high readability I have been using the or and and operators as synonyms for || and &&. Though, now I have come to the understanding that or and and have a ...
0
votes
2answers
33 views
Unexpected if/else results using booleans
I'm setting up some simple booleans that test for mobile layouts and touch devices, but I'm having some difficulty making the code more compact.
isTouch tests for touch devices.
mobile tests for ...
0
votes
1answer
18 views
Boolean in a view
I have a trouble to show an result of boolean value in a view
I want to show enable and disable but show true or false
my code in index.html.slim
th Active?
td = plan.enable
my ...
0
votes
2answers
15 views
Rails 4.x how to query boolean value with activerecord?
I a boolean "guessed" on my model "perks" and I am trying to get all customers that have perks where guessed is true.
My first guess was this:
@customer = ...
1
vote
1answer
19 views
Ajax : call a boolean Action
I want to get a boolean value from an Action and make a test according to the return value in the corresponding AJAX function.
I've put a breakpoint on the Action but my submission passes without ...
1
vote
0answers
29 views
How to create an algorithm for determining Boolean Tautologies [migrated]
So i am right now exploring some topics in a proof course and it occurred to me to try to create a boolean tautology solver. I would like an algorithm that is more efficient than brute force.
Problem ...
0
votes
1answer
16 views
Javascript - Boolean global variable in child function not changing
I am working on s atudent project: a 'hot or cold' game app but can't seem to understand something.
Here's the link to the project: The user is supposed to input numbers in the text box trying to ...
1
vote
2answers
41 views
Problems with boolean statement and if statement in python
def test():
boo = True
enter = int(raw_input("Enter something: "))
if enter > 0:
boo = False
print "Did it work?!"
else:
print "Still working..."
while ...
0
votes
4answers
79 views
What does bool() actually do in python? [closed]
For what it is being used in python? I'm learning python using this tutorial. This is described here (middle of the page), but I can't get it. I understand the principles of using True and False, but ...
1
vote
3answers
62 views
scala boolean variables need to change dynamicly
I have this method that I need to evaluate an expression based on these Boolean values:
var Ma, Co, Ar, Le, St, Ri: Boolean = false
def Logic: Boolean =
(Ma & (!Ma | Co) & (!Ma | ...
1
vote
1answer
59 views
Changing variable values from object fields
The following is my code:
package com.collegeselector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import android.app.ListActivity;
import ...
-5
votes
1answer
41 views
Pass boolean value to another class
In my main class I want to check if there was a change by using a boolean variable:
public class Main {
private boolean change = false;
public boolean getChange() {
return change;
...
1
vote
1answer
35 views
rewriting a for loop to include any type of object
I have a problem that I'm stuck on. Namely, I have a for loop that goes through an integer array and compares it to another integer. If any integer in the array is the same as the given integer it's ...
0
votes
2answers
111 views
Is there only one True and one False object in Python?
I know that Python guarantees that there is only one instance of NoneType, the None object, so that you can safely use is None to test if something equals None.
Is there an equivalent guarantee for ...
0
votes
2answers
36 views
How do I check if an array of Booleans is all true in Actionscript 3?
Well, technically not all the Booleans. I have an array (ArrayMain) that stores a player and a bunch of other movieclips in an array, and I have another array of Booleans (this corresponds to the ...
0
votes
1answer
18 views
Boolean full text search order by relevancy doesnt seem to work
OK so I've got two queries that I'm testing and they produce exactly the same results, which goes to say that somehow ordering by relevancy doesnt seem to work here:
$query1 = "SELECT * FROM ads
...
1
vote
1answer
25 views
Javascript: Using two arguments to do a while loop with a Boolean comparison
I am going to try and do this as best as I can.
var myPrompt = prompt("Are you ready to go?");
if myPrompt == true {
console.log("Great, let's go.")
} else {
console.log("Hurry up, we don't ...
0
votes
1answer
10 views
Best index choice for Boolean type in OrientDB
I'm setting a flag on my records to see which ones have already been processed by my import script, and am wondering what type of index I should use. My thought is to use NOTUNIQUE_HASH_INDEX. Is that ...
0
votes
2answers
32 views
Boolean always outputs true
I have a class to test a palindrome. In my loop, it compares each letter to see if they match, if they don't, it's supposed to make the boolean variable as false, or vice versa. Now I've tested it a ...
0
votes
2answers
33 views
How do you overload Linq's Where clause to accept SqlBoolean?
Linq's Where clause works with booleans. How do you get it to work with sqlBooleans. Here is sample code to illustrate the problem
// Trivia example to draw attention to the problem
var ...
1
vote
3answers
11 views
jquery click handles extra function after boolean changed
In this fiddle I have a div that moves when another element is clicked and moves back when all elements except for the div itself are clicked. I check what position it is in with a boolean. the ...
0
votes
1answer
27 views
Order ListView by boolean and double values
I have a ListView which is currently in ascending order based on a double value that each element of the listview has.
List
public class CollegeList extends ListActivity {
...
0
votes
1answer
37 views
Is there any elegance way to input boolean data in if statement
I coded like below.
item.count and item.chip 's data type is number
If item.amout is less than item.chip, completion variable is assigned to true.
If not, completion is assigned to false.
Then that ...
0
votes
2answers
19 views
java change OR to AND
I have a if check with OR condition
how to convert to use AND condition
if ( a!=null || !a.equals(""))
return a
else
return "n/a"
How do I execute this logic using AND && condition ?