in reply to deep usage of if-else!!
It's hard to say w/o knowing what the check() and state() methods do and their return values.. In general, I would say to push things off into methods ..if( do{$o->check(...); ! $o->state} ){ action.. }elsif( do{$o->check(...); ! $o->state} ){ action.... $o->blah() if ($o->state) { actions..check.. unless($r->state) { and so on...deeper and deeper... } } }
So what does the check() method return? if it did return $this->state then things simplify alot:$o->check(...); unless ($o->state) { $o->actionSet1; } else { $o->check(...); unless ($o->state) { $o->actionSet1; } }
unless ( $o->check(...) ) { action.. } else { unless ( $o->check(...) ) { action.... $o->blah() if ($o->state) { actions.. unless( $o->check(...) ) { and so on...deeper and deeper... } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: deep usage of if-else!!
by rootcho (Pilgrim) on May 01, 2006 at 18:27 UTC | |
by davidrw (Prior) on May 01, 2006 at 18:54 UTC | |
|
Re^2: deep usage of if-else!!
by Anonymous Monk on May 01, 2006 at 19:24 UTC |