PDA

View Full Version : Optimize programming (CASE vs IF)



CGibson
2015-01-07, 14:09
Hello,

I'm wondering which method provides better performance: case statements or if statements?
Some of the articles I've read indicate that it all depends on the environment.

Thanks,
Cory

barrymavin
2015-01-07, 20:04
The compiler will optimize anyway. There is no difference in performance.

If Your code is merely trying to assign a value based on a condition you should also look at IIF() and ICASE() in the doc wiki. These are faster than using compiled statements for simple values.

CGibson
2015-01-08, 08:53
Hi Barry,

Thanks for the feedback.

Cory