Mail Archives: djgpp/1999/07/31/13:45:34
In comp.os.msdos.programmer Peter "Shaggy" Haywood <phaywood AT aardvark DOT apana DOT org DOT au DOT stop DOT spam> wrote:
> Groovy hepcat Dave Dutcher was jivin' on 27 Jul 1999 21:44:32 GMT in
> comp.os.msdos.programmer.
> Re: Iteration vs. Recursion...'s a cool scene! Dig it!
>>But I couldn't help noticing that a lot of people suggested switch
>>statements. I wonder if people suggested a switch statement because the
>>orignal poster was looking to increase his speed, or did they suggest it
>>because they think switch statements are more readable? I am wondering
>>because, from what I have heard, switch statements are no faster than a
>>whole bunch of if statements.
> That's not always true. A switch can be more efficient than a series
> of if statements, but that all depends on the compiler.
> But I'd say the suggestion to use switch instead of if was more for
> readability than anithing else.
Personally, I usually use if / else for up to 3 conditions,
and switch for 4 or more, and that's mainly because of
readability.
- Raw text -