Questions tagged [boolean-expression]

A boolean expression is an expression in a programming language that produces a boolean value when evaluated, i.e. one of true or false.

In computer science, a Boolean expression is an expression in a programming language that produces a Boolean value when evaluated, i.e. one of true or false. A Boolean expression may be composed of a combination of the Boolean constants true or false, Boolean-typed variables, Boolean-valued operators, and Boolean-valued functions.

1049 questions
-5
votes
4 answers

Else statement and while loop

Code skips the error if statements and goes straight to the else if I need laps to go through and if its less than 2 then it'll go to the error and come back again to ask to enter a new value. vice versa for greater than 20. Im a new programmer and…
-5
votes
1 answer

Can someone explain to me this question in C

Been trying to figure out this stuff. This has to do with boolean algebra and is suing the C language. It has some algebra in it. Not sure how this works. Been trying to figure this out for half hour Simplify the following Boolean expressions. a. …
UI Developer
  • 167
  • 6
  • 16
-5
votes
2 answers

Are there any syntax errors in this case statement? Language = SQL Server

case ('monthcharge' <> 0) WHEN TRUE THEN 'monthcharge' * datediff(mm,, 'start', 'stop') WHEN FALSE THEN case ('weekcharge' <>0) WHEN TRUE THEN 'weekcharge' * datediff(ww, 'start', 'stop') WHEN FALSE THEN…
-5
votes
1 answer

How to simplify these boolean statements

I'm told to condense this in python in a more simplified form. Is it possible to do so in an orderly manner? (not ((b or not c) and (not a or not c))) or (not (c or not (b and c))) or (a and not c) and (not a or (a and b and c) or (a and ((b and not…
-5
votes
1 answer

Boolean algebra in computer science

The problem is here. I don't have enough reputation to post the picture so here is the Imgur link: https://i.stack.imgur.com/6Zpwg.jpg
-5
votes
2 answers

Can you determine the terminating boolean expression of a for loop dynamically?

I'm in a situation where it would be really nice to be able to determine what boolean expression I use for the terminating statement of a for loop at runtime. Or in more simpler words, decide whether I want i > 0, or i < file.length and decrement or…
Bradley
  • 1,234
  • 1
  • 12
  • 24
-5
votes
3 answers

Need help executing a true/false boolean which includes a for-loop and a conditional

Right now I have my boolean setup like this: public boolean deleteItem(String p) { for(int i = this.myList.size() - 1; i > -1; i--) { if(this.myList.get(i) == p) { this.myList.remove(i); return true; }…
-5
votes
3 answers

Transform an expression only using NAND logic gates

How do I transform this expression NOT(a) OR NOT(b) AND NOT(c) using only NAND gates?? I was trying to do it, but I don't find the correct answer.
-5
votes
1 answer

Ambiguous Boolean Expressions

I was reading through some old code and came across an unqualified Boolean expression like this: if (first && second || third) { // do something } There are two valid ways of qualifying that expression. if ((first && second) || third) and if…
gcarvelli
  • 1,580
  • 1
  • 10
  • 15
-5
votes
6 answers

how can I simplify this expression

if (this.skills[i].isBasic() == true) how to simplify this expression ?
moaz yahia
  • 21
  • 1
-6
votes
3 answers

C# random number and greater than operator

I'm trying to generate a random number and give the user 5 tries to guess the right number. I want to compare their guess and tell them if they're too high or too low. VS wont execute and I don't understand why I'm getting errors. using…
DawnMoon
  • 1
  • 2
-6
votes
3 answers

Is there a post-assignment operator for a boolean?

Hi is something like this possible in Java? boolean flag = true; if(flag) return flag = false; // return true and assign false to flag afterwards To clarify. The above works, but is assigns false first. Want I want to achieve is to return the flag…
Murat Karagöz
  • 35,401
  • 16
  • 78
  • 107
-7
votes
2 answers

Why is this boolean variable assigned true?

I have the following two code snippets which produce different outputs: boolean a = false, b = false, c = false, d = false; if (a = false | (b = false) || (c = true) | (d = true)){ } System.out.println("if (a = false | (b = false) || (c = true) |…
-8
votes
2 answers

C++: Why does this logical expression evaluate to false?

int a = 10, b = 12, c = 8 !((a < 5) || (c < (a + b))) I just tried it in a compiler and it was false.
user3724404
  • 216
  • 2
  • 9
1 2 3
69
70