in reply to Use of SWITCH vs IF ELSE in speed and readability
It's going to print 1, because 1 is true, so that the if (1) statement is always executed.$x = 3; SWITCH: for ($x) { if (1) { print '1'; last SWITCH; }; if (2) { print '2'; last SWITCH; }; if (3) { print '3'; last SWITCH; }; print 'caught'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Use of SWITCH vs IF ELSE in speed and readability
by bradcathey (Prior) on Aug 30, 2003 at 17:35 UTC | |
by CombatSquirrel (Hermit) on Aug 31, 2003 at 00:10 UTC |