|
-
Oct 18th, 2012, 12:15 AM
#3
Thread Starter
Junior Member
Re: I need help with my Code Its driving me CRAZY
 Originally Posted by jmcilhinney
You're saying that it's not valid if it's not equal to * or it's not equal to - or it's not equal to * or it's not equal to /. If the user enters one of those four operators then one of your conditions will be true but the other three will be false, so the whole expression will be false. You should be using logical AND operators, not logical OR operators. Only if all four conditions is true is the value invalid.
By the way, it's very rare that you should be using the logical | and & operators. You should almost exclusively use the || and && operators because they short-circuit. You should only use the single versions when you specifically don't want to short-circuit, but such code would generally be considered poor in C# anyway.
Thanks your Awesome!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|