Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:40:58+00:00 2026-06-14T22:40:58+00:00

I have myself a IF state, tempNum2 = 4, tempNum2 = 3 answer1 =

  • 0

I have myself a IF state,

tempNum2 = 4, tempNum2 = 3

answer1 = 1, answer2 = 3, answer3 = 2, answer4 = 4

if( (tempNum2== answer2 || tempNum1== answer2) &&
    (tempNum2!= answer1 || tempNum1!= answer1) &&
    (tempNum2!= answer4 || tempNum1!= answer4) &&
    (tempNum2!= answer3 || tempNum1!= answer3) &&
    (asnwer5 == 0))
 {
     console.log("Correct");
 }

now looking at the if statement, tempNum2 is equal to answer4, but in my firefox console, it prints out Correct, looking at the if statement, it should fail. Because tempNum2 is 4, and answer4 = 4, so this if statement should fail, what is wrong with this statement? Dont worry about anything else, I’m sure I have this if statement wrong.

Canvas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:41:00+00:00Added an answer on June 14, 2026 at 10:41 pm

    You have to have one of all 4 or clauses, as you are using an and everywhere. Plus I don’t know what answer 5 is, so I can’t speak to that, but it should also be true, however it is defined. It is possible that if you change your && to ||, it will work, but I don’t know what logic you are trying to use.

    (false || false)&&
    (true || true)&&
    (true || false)&&
    (true|| true)
    
    false && true && true && true
    

    I don’t know what logic you want exactly, but your code is doing exactly what you told it to. In fact:

    (tempNum2== answer2 || tempNum1== answer2)
    

    So, unless tempNum2= tempNum1= answer2, this logic will always return false.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have myself a linear grid of Vector2s stored in a Vector2[,] array, and
I have myself a handle to a bitmap, in C++, on Windows: HBITMAP hBitmap;
I have a program which i have myself written in java, but I want
I have gotten myself into a catch 22 and cannot seem to find my
I have found myself designing a language for fun that is a cross between
I have backed myself into a a bit of a corner. Here is a
I have found myself doing this in my code to 'cache' the work done
I have worked myself into a tricky situation and find myself unable to fight
I have run into a problem trying to modify a form I myself have
I'm new to Java and have gotten myself into a situation where it's evident

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.