Question about variables
#1

Do I have to check if variable's value is different before setting it?

Example

Code:
new bool:IsSpawned[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
	IsSpawned[playerid] = true;
	return 1;
}
or

Code:
new bool:IsSpawned[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
	if(IsSpawned[playerid] != true)
	{
		IsSpawned[playerid] = true;
	}
	return 1;
}
Which way is better? Or is there no difference?
Reply


Messages In This Thread
Question about variables - by 2Col - 07.07.2018, 15:51
Re: Question about variables - by Dayrion - 08.07.2018, 04:13

Forum Jump:


Users browsing this thread: 1 Guest(s)