Basic Logical Operator Use [on hold]


Jake Levitt
25/12/2015 9:47 am
HOME » Programming Languages

I am trying to program a very simple program that will tests if the input string is one or two and then does the action. However, I can't seem to get it working. Can someone help me?

    String input;
    input = Input.getString("Hi.");

    if ( (input == "one") | (input == "two") )
    {
    System.out.println(input);
    }   
}

Related to : Basic Logical Operator Use [on hold]
Basic Logical Operator Use [on hold]
25/12/2015 9:47 am by Jake Levitt in Programming Languages

I am trying to program a very simple program that will tests if the input string is one or two and then does the action. However, I can't seem to get it working. Can someone help me?

    String input;
    input = Input.getString("Hi.");

    if ( (input == "one") | (input == "two"
logical OR operator vs bitwise OR operator
by yhelothar in Programming Languages

does anyone know why:


if (false && true || true) {
System.out.println("True");
} else {
System.out.println("False");
}

Print "True"


if (false && true | true) {
System.out.println("T
Basic identities of logical expressions and deriving logical expressions from truth table?
by ronansprake in Programming Languages

I was wondering what a basic identity of a logical expression is and how to get it. I looked on google but couldn't find anything about it.


Say, for example I have a logical expression ~(~(P ^ ~(P ^ Q)) ^ ~(Q ^ ~(P ^ Q)))
Below is the result I got from a truth table and I don't k


Logical Operator "Xor"
by Bjørn Lyngwa in Programming Languages
I have a table of Addresses for various companies. Some of the companies will have more than one address. For this report I only need one address, which is TypeofAddress ID = 1. Therefore, I created a query and use this criteria on the TypeofAddressID field: 1 Xor 2 Xor 3 Xor 7 Xor. The re
logical operator
by Iceland in Programming Languages
Hi
How would I compare a string to multiple values, ie. do this same action if
string "abc" is equal to string X, or string Y or string Z? I know I can do
it in three nested if-else statement, but is there a smarter way?
TIA
--
Nov 17 05
Logical Operator OR !! $ !!
by Iron Woode in Programming Languages
Hey,
I'm having troubles figuring this out:
The functioning of OR in mysql is that it executes both conditions (before and after OR) and returns the result of both.
What I'm looking for is a way to be able to have the functionality of the php OR, meaning that only if the first conditi
Help with Logical And Operator
by obijywk in Programming Languages
Somehow the AND Operator in my code doesent work
What my useless "Program" does:
The program ask you to write a number from 1-10
What I want it to do:
If its above 10 it print that the number is to high
If its below 0 it print that the number is to low
If i
Logical Not Operator !
by zac in Programming Languages

I have some questions about the logical not operator in C++ and Visual C++. I have posted another question relating to the logical not operator. I just can't seem to wrap my head around the uses of this operator. From what I have read so far the logical not operator can switch the value of bool v


Logical Operator help
by Silverforce11 in Programming Languages

Im reading about logical operators (yes noob here) and Im sort of confused as to what some of them actually mean.

Example: if b1 is true and b2 is false

!(b1 & b2) is true
b1 | b2 is true
b1 & b2 is false
b1 ^ b2 is true

i know that:

& is AND


Xor Logical Operator in C++
by overst33r in Programming Languages

WE have the && operator, the || operator, but xor is only implemented
as '^' . And this causes a lot of confusion.

Let's take this case: 2 == 2 ^ 2 generates a logical operation instead of bitwise operation , therefore returning a true value.

What do yo think: Should t


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .