View Single Post
  #1  
Old 03-21-2006, 10:10 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Using return; to end a script

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;
      }
    }
  }

Reply With Quote