The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › Back End › [Solved] Switch or if()?
This is a question that I’ve pondered for a while. Which is more code-efficient? Which is more performance-efficient? Will a switch statement run quicker than many different if statements?
Take this for example:
Would the above if statement run better than:
Thanks for any opinions.
yea I agree with Mark – :)
Thanks guys, I had a feeling a switch would run better than an if/elseif/else.
Thanks for clarifying, just trying to make my code more efficient! :)