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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:56:50+00:00 2026-06-14T10:56:50+00:00

string confirm = ; while (confirm != y || confirm != n) { Console.Write(Remove

  • 0
string confirm = "";

                    while (confirm != "y" || confirm != "n")
                    {
                        Console.Write("Remove {0}' account? (Y/N): ", Accounts[accountNumber].Name);
                        confirm = Console.ReadLine();
                        confirm = confirm.ToLower();
                    } 

For some unknown reason my loop fails on the check. Even if confirm IS either “n” or “y” it will still loop round again. I have even checked it is definitely matched to either “n” or “y” by using a break-point. So why is this failing the check each time?

  • 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-14T10:56:52+00:00Added an answer on June 14, 2026 at 10:56 am

    Because your string cant be both y and n. Replace the || with &&:

    while (confirm != "y" && confirm != "n")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

string name = bob; object obj = name; obj = joe; Console.WriteLine(name); I'm a
With the following object hierarchy, I need to confirm whether or not all string
I've used strpbrk() occasionally while doing low-level string work in C, but I've never
I would like to know if this looks correct : while((next !=NULL) && (strcmp(next->name,
For some reason, I couldn't find a good answer in google why this code
I already know how it works with a single parameter OnClientClick='<%# String.Format(confirm_ticket({0});return false;,DataBinder.Eval(Container,DataItem.idAgir))%> '
I want to conform my site's string handling to support other languages per UTF-8.
string a = sea; string b = SEA if (a == b)... How could
String baseString=POST&; String subBaseString = oauth_consumer_key=+oauth_consumer_key+&oauth_nonce=+nonce+&oauth_signature_method=+oauth_signature_method; subBaseString += &oauth_timestamp=+ oauth_timestamp+&oauth_token=+oauth_token+&oauth_version=1.0; baseString += URLEncoder.encode(baseRequest, UTF-8);
string in question: '{images:{0:<div style=\\background:red;width:250px;height:250px;display:block;position:absolute;\\></div>}}' I've tried various combinations of single and double quotes.

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.