On Sun, Mar 22, 2009 at 00:28, Lee Jenkins <[email protected]> wrote:
> Can anyone say why there is no string case statement in Object Pascal?  I've
> always wondered about this as sometimes it hard to avoid 10-20 If..then..else
> if.... statements.

I'd say it is because nobody contributed it ;-)

> Would the compiled code of a string case statement even be any more efficient 
> or
> is the benefit mostly in code readability?

Both. It can be implemented as prefix tree,
giving O(MaxLength) instead of O(MaxLength*NumberOfCases) time _and_
a much better readability/maintainability.


-- 
Alexander S. Klenin

_______________________________________________
Lazarus mailing list
[email protected]
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to