Thread: If statements
View Single Post
Old 09-17-2002, 09:55 PM   #6 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
I'm more referring to the fact that you can just "return" from a function thereby not needing the "else" part because your program will never get there if it "returns" prior.

e.g.

Code:
private void x()
{
 a();
 b();
 return;
 c();
}
gives a "Error, unreachable statement" at "c()" in java at least, im not sure if php supports it but i think it would from what i've seen.

i usually prefer the "long way" you're referring to as well and the way i'm suggesting would make it a little weird to read for debugging but i think it saves heaps of time, for me at least.
__________________
-- bloomberg.
abc123 is offline   Reply With Quote