Quote:
Originally posted by HoudiniMan
Why do people do those "elseif"s in this situation?
I KNOW for a fact "if" by itself would work fine, i was just wondering if there's acutally a viable reason for doing this...
|
Optimization.
NPC Code:
// Both are being checked.
if (thing==A) {
}
if (thing==B) {
}
// If the first statement is false, check the second statement, else, skip the second statement.
if (thing==A) {
}
else if (thing==B) {
}
Think of it this way:
If thing is A, how could it ever be B? So why should you check it twice if thing is A?