1

I have an if-else statement wherein it would not run if two variables have the same value. But if those two variables are both "0", it would run.

if (a != b){
     //it should also proceed here if a and b are both "0". What should my statement be?
}
4
  • What's your variable type? Commented Apr 19, 2019 at 3:07
  • Possible duplicate of C# 'or' operator? Commented Apr 19, 2019 at 3:07
  • it is actually a string Commented Apr 19, 2019 at 3:10
  • Have you check the string Length? Commented Apr 19, 2019 at 3:21

1 Answer 1

2
I've solved it guys. Thank you.

if (a != b || (a == "0" && b == "0")){
   //it should also proceed here if a and b are both "0". What should my statement be?
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.