Lately, I've been getting lazy and using 'if (condition) return;' instead of piling up the if (condition) { if (condition) { if (condition) { } } }
Is there any harm that can be caused by doing this?
For example..
PHP Code:
function onActionDamage(dmg,from,fromguild) {
if (player.guild == fromguild && player.guild.length() > 0) return;
if (player.account == from) return;
if (client.allies.index(from) >= 0) return;
client.hp -= dmg;
}
Instead of..
PHP Code:
function onActionDamage(dmg,from,fromguild) {
if (player.guild != fromguild || player.guild.length <= 0) {
if (player.account != from) {
if (client.allies.index(from) == -1) {
client.hp -= dmg;
}
}
}
}