If/else vs. select/case

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

If/else vs. select/case

Randy Phillips
I think this has been discussed before but are there any performance
advantages to select/case statements versus if/else statements?

Rp



--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: If/else vs. select/case

jasonhuck
IIRC, select/case evaluates each case one at a time, and quits as soon
as it finds a match (IOW, it ignores the rest of the unused cases),
whereas if/else evaluates the entire expression first, before making a
decision.

So if you have a lot of cases to evaluate, I would expect select/case
to be faster for the cases at the top of the list...

...but I could be wrong about all of that. :)

JLH


On 6/6/05, Randy Phillips <[hidden email]> wrote:
> I think this has been discussed before but are there any performance
> advantages to select/case statements versus if/else statements?
>
> Rp

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: If/else vs. select/case

Fletcher Sandbeck
In reply to this post by Randy Phillips
On 6/6/05 at 9:34 AM by [hidden email] (Randy Phillips):

>I think this has been discussed before but are there any performance
>advantages to select/case statements versus if/else statements?

There shouldn't be any practical difference.  Select/case was added because it was a frequent feature request and it makes some code easier to read and maintain.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Lasso Product Specialist              [hidden email]
OmniPilot Software, Inc.                http://www.omnipilot.com

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage