if-else or switch? Whats better?
#1

Ahoy friends.

Im trying to do this

Код:
		switch(TEAMSIZE)
		{
		case >=2:
		{
			switch(gPlayerTeamSelection[playerid])
			{
				case 1:
				{
				SetPlayerColor(playerid,COLOR_TEAM_ONE);	
				}
				case 2:
				{
				SetPlayerColor(playerid,COLOR_TEAM_TWO);	
				}
			}
		}
		case >=3:
		{
			switch(gPlayerTeamSelection[playerid])
			{
				case 3:
				{
				SetPlayerColor(playerid,COLOR_TEAM_THREE);	
				}
			}
		}
		case >=4:
		{
			switch(gPlayerTeamSelection[playerid])
			{
				case 3:
				{
				SetPlayerColor(playerid,COLOR_TEAM_FOUR);	
				}
			}
		}
		case >=5:
		{
			switch(gPlayerTeamSelection[playerid])
			{
				case 3:
				{
				SetPlayerColor(playerid,COLOR_TEAM_FIVE);	
				}
			}
		}
		case >=6:
		{
			switch(gPlayerTeamSelection[playerid])
			{
				case 3:
				{
				SetPlayerColor(playerid,COLOR_TEAM_SIX);	
				}
			}
		}
Can i use >=6 in switch case or do i have to use if-else-if ? Because according to the compiler its an invalid expression

Maybe someone can help to find the best way
Reply


Messages In This Thread
if-else or switch? Whats better? - by faxxe - 11.03.2017, 17:10
Re: if-else or switch? Whats better? - by Jefff - 11.03.2017, 17:15
Re: if-else or switch? Whats better? - by faxxe - 11.03.2017, 18:35

Forum Jump:


Users browsing this thread: 3 Guest(s)