Re: IF or SWITCH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

If your strong-comings are better than my shortcomings, then perhaps you could provide an example of where a switch could not preform what an if/elseif could -- do you have one?

My gut feeling is that you can't -- as well as my gut feeling that when language developers first thought of if/elseif control, they realized that it was confusing and provided a switch to get around it. But, then again, maybe I'm wrong -- been there before. :-)

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux