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 6055363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:15:23+00:00 2026-05-23T08:15:23+00:00

I have an if statement that looks as follows: int count=0; string Check; if

  • 0

I have an if statement that looks as follows:

int count=0;
string Check;

if ((count==4 && Check!="-s")||(count==4 && Check!="-S"))

If count equals 4 and Check equals "-s" or "-S" it still enters this if statement because of the count == 4. It totally seems to ignore the second part. Is there something I’m doing wrong?

  • 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-05-23T08:15:24+00:00Added an answer on May 23, 2026 at 8:15 am

    Well, if Check is "-S", then it will not even check the second pair of conditions, because you check with ||. The same holds true for the opposite case. If one is false, the other is true. Replace that with a &&.

    int count = 4;
    string Check = "-S";
    
    if( (count == 4 && // count is 4, alright.
         Check != "-s") || // Check is "-S", alright I'm done thanks to || (OR)
        (count == 4 &&
         Check != "-S") )
    {
      // ...
    }
    
    int count = 4;
    string Check = "-s";
    
    if( (count == 4 && // count is 4, alright.
         Check != "-s") || // Check is "-S", time to check the other condition pair...
        (count == 4 && // count is 4, alright.
         Check != "-S") ) // Check is "-s", which is different from "-S", perfect.
    {
      // ...
    }
    

    Now the corrected version:

    int count = 4;
    string Check = "-S";
    
    if( (count == 4 && // count is 4, alright.
         Check != "-s") && // Check is "-S", different from "-s", now on to the other condition!
        (count == 4 && // count is 4, alright.
         Check != "-S") ) // Check is "-S"... oh dang! No executed code for you.
    {
      // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have LINQ statement that looks like this: return ( from c in customers
I have a statement that looks something like this if not @user.verified? or @user.credit_card.expired?
I have an INSERT statement that looks like this: INSERT INTO officer (officer_number, name,
I have a SELECT statement that looks like this: SELECT * FROM photos, p_votes
I have this table that looks like this CREATE TABLE `purchases` ( `id` INT(10)
I have a statement that looks something like this: MERGE INTO someTable st USING
If i have a table that looks like this: ID int Name varchar City1
I have a SQL statement that looks like: SELECT [Phone] FROM [Table] WHERE (
I have an annoying SQL statement that seem simple but it looks awfull. I
I have an if statement that needs to look like this: UPDATE $(input#textbox).keypress(function(e){ key==e.which;

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.