You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.
You need to be logged in to post and to see the uncensored versions of these forums.
Hey JMac's got another programming question | |||||||
---|---|---|---|---|---|---|---|
|
This is C#, but I’m sure this crosses over into a few other languages.
I’m just confused if and how a conditional-and (&&) logical operator works differently than just the and (&) operator.
Conditional means that it only checks the first value if necessary, but both should always be necessary in any and statement, conditional or not, since and returns true only id both statements are true.
It’s like mixing an ‘or’ with an ‘and’ making the ‘or’ useless imo. |
||||||
Posted On: 10/03/2009 12:18AM | View Johnny Mac's Profile | # | ||||||
|
Oh no **** nevermind. |
||||||
Posted On: 10/03/2009 12:28AM | View Johnny Mac's Profile | # | ||||||
|
Closet of shame |
||||||
Posted On: 10/03/2009 12:36AM | View Johnny Mac's Profile | # | ||||||
|
O hay another question i don’t know the answer to
Why should we test for both upper and lowercase letters or use ToUpper( ) to convert letters to uppercase? |
||||||
Posted On: 10/03/2009 12:54AM | View Johnny Mac's Profile | # | ||||||
Johnny Mac Posted:
From what I’ve found, it’s a matter of an easier comparison, regardless of what a user types. If you are asking for…say…pet’s name, and the person doesn’t remember if the original contained an initial cap, then you’d convert the initial response and the new response to all caps and compare the two.
It appears that in string comparisons in C#, as in many languages, “Text” and “teXt” are not equal. |
|||||||
Posted On: 10/03/2009 1:05AM | View tracylee's Profile | # | ||||||
|
Johnny Mac Posted:
Now you’ve got me interested… what was the answer? |
||||||
Posted On: 10/03/2009 5:38PM | View man-man's Profile | # | ||||||
|
man-man Posted:
It’s just if the first statement in the && is false, it doesn’t bother checking the second at all. & would check both anyway.
In my mind I only ran through true-true and true-false scenarios. |
||||||
Posted On: 10/03/2009 5:53PM | View Johnny Mac's Profile | # | ||||||
|
I was making the same mistake… Log in to see images! |
||||||
Posted On: 10/03/2009 6:32PM | View man-man's Profile | # | ||||||