View Single Post
Author Message
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 11-26-2013 , 08:39   Question related to Swich Statements.
Reply With Quote #1

Not entirely convinced by the performance values so I figured I'd post here for a quick answer.

Would this for example...
Code:
new value;
if (value == 1)
{
	//Do stuff
}
else if (value == 2)
{
	//Do other stuff
}
Be a bit more effective in terms of performance or this...
Code:
new value;
switch (value)
{
	case 1:
		{
			//Do stuff
		}
	case 2:
		{
			//Do other stuff
		}
}
Purely, which one runs better or does it not matter? I like Switch statements a lot better.

Cheers,
- Jack

Last edited by Drixevel; 11-26-2013 at 08:39.
Drixevel is offline