Quote:
Originally Posted by didoWEE
Functionality is not the same!
My way
PHP Code:
if(!is_user_connected(killer))
return HAM_IGNORED; // if true - function stops --> 1 if
if(killer == victim)
return HAM_IGNORED; // if true - function stops --> 2 ifs
if(!is_real_player(killer))
return HAM_IGNORED; // if true - function stops --> 3 ifs
if(g_bFlagged[killer])
return HAM_IGNORED; // if true - function stops --> 4 ifs
Your way
PHP Code:
if(!is_user_connected(killer) || killer == victim || !is_real_player(killer) || g_bFlagged[killer])
return HAM_IGNORED; // if true - function stops -> Always 4 ifs
|
Actually it is same, just the 2nd way is more readable.
OR operator returns true on the first thing to return true.
Example:
PHP Code:
new x = 0;
if (x == 1 || x == 5 || x == 10) // Will not check if x is 5 or 10 if x is 1. If x is 5, it will not check if x is 10.
// Code here