Re: IF or SWITCH

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

 



At 05:56 PM 4/6/2006, John Nichel wrote:
<snip>
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

Ye gods -- I'm getting old. I had to look this up.
Yup - Pascal has

        case operator of
                .. statements ...
        otherwise
                .. statement
        end;

And you can group cases.

Forgotten all that - had to look it up.

What I think happens is that we are merrily noodling along in our code, and a condition rears its head. Simple - if .. else. Then things get a bit more complicated, and so we end up with nested if .. elseif .. else constructs.

Personally I like the clarity of switch, but don't use it often because I generally try to avoid messy nests of conditions.

Cheers - Miles

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.385 / Virus Database: 268.3.5/302 - Release Date: 4/5/2006

--
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