Re: IF or SWITCH

From: Date: Thu, 06 Apr 2006 20:56:38 +0000
Subject: Re: IF or SWITCH
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-233404@lists.php.net to get a copy of this message
tedd wrote:
At 1:04 PM -0400 4/6/06, Robert Cummings wrote:
On Thu, 2006-04-06 at 11:50, tedd wrote:
Regardless of speed, I find that switch is much easier to write and debug than if/elseif -- which, regardless of my shortcomings, I never use.
Umm, that you NEVER use elseif I think is strongly coupled with your shortcomings :l But I'm not judging, to each his own :| Cheers, Rob.
Rob: Yes NEVER -- as for my shortcomings, they remain as obvious as is my lack of pretense otherwise. Whereas, my abilities, like most, are not as obvious. As Will Roger's once said "We're all ignorant, only in different subjects." But regardless of my limitations, I still have never had to use an if/elseif for anything -- and I wrote my first line of code in 1966. I don't remember specifically just when if/elseif and switch-like conditionals first appeared in programming (they haven't always been there and my old Fortran books have been long stored) but I have one in front of me that's dated 1976 where it just mentions "The Logical IF Statement" with no if/else or switch-like statements. So, my programming probably predates both conditions -- however -- in 40 years I have NEVER used an if/elseif control structure by any name and I always found a way around it -- and one that was usually faster and with better readability.
I remember IF constructs from BASIC and PASCAL, but no switch statements (somebody correct me if I'm wrong). But what I'm wondering is how in the world did you do conditional checking if there were no switches, and you don't use IF's? Did you not code error handling, different cases based on user input, status of a data stream, etc in all the years prior to something like switch being introduced??? -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#233404) next »