Re: Nested if and elsif and else

2010-04-15 Thread Harry Putnam
have over 10k lines of perl code in one system with about 10 else's and maybe 3 elsif's. it just is a matter of knowing how to manage flow control well and you rarely need else's. Can someone show an example of an if/elsif/else nested construct being replaced by a dispatch table

Re: Nested if and elsif and else

2010-04-15 Thread rkb
. without ANY serious work, i have over 10k lines of perl code in one system with about 10 else's and maybe 3 elsif's. it just is a matter of knowing how to manage flow control well and you rarely need else's. Can someone show an example of an if/elsif/else nested construct being replaced

Re: Nested if and elsif and else

2010-04-15 Thread Harry Putnam
r...@i.frys.com writes: Here's an example I gave in a similar question in another forum. Thanks... I'm sorry to ask more but if someone asked to be shown an if/elsif/else construct being replaced by a dispatch table, I don't really see how that answered there question. It didn't for me.

Re: Nested if and elsif and else

2010-04-15 Thread Jim Gibson
On 4/15/10 Thu Apr 15, 2010 9:21 AM, Harry Putnam rea...@newsguy.com scribbled: r...@i.frys.com writes: Here's an example I gave in a similar question in another forum. Thanks... I'm sorry to ask more but if someone asked to be shown an if/elsif/else construct being replaced by a

Re: Nested if and elsif and else

2010-04-15 Thread Ron Bergin
On Apr 15, 9:21 am, rea...@newsguy.com (Harry Putnam) wrote: r...@i.frys.com writes: Here's an example I gave in a similar question in another forum. Thanks... I'm sorry to ask more but if someone asked to be shown an if/elsif/else construct being replaced by a dispatch table, I don't

Re: Nested if and elsif and else

2010-04-15 Thread Harry Putnam
Ron Bergin r...@i.frys.com writes: Sorry for not posting the if/elsif/else block, but to me that part appeared to be obvious, but I guess it wasn't. Probably would have been for all but the densist I guess. Not the first time I've been guilty of that. I see that Jim has posted the

Re: Nested if and elsif and else

2010-04-14 Thread Shlomi Fish
On Wednesday 14 Apr 2010 02:35:50 Mimi Cafe wrote: I think this will work, but is it elegant.? If (condition){ if (nexted_condition){ do this. } Elsif (nexted_condition){ Do that... } else{ Do something else. } } else{

RE: Nested if and elsif and else

2010-04-14 Thread Mimi Cafe
Yes, the nested if and elsif and else makes the code difficult to read and I often get stuck trying to make sense of it all. For now, I will look to see if I can move some bit and pieces to subroutines to improve readability. Thanks guys Mimi -Original Message- From: Jim Gibson

Re: Nested if and elsif and else

2010-04-14 Thread Steve Bertrand
On 2010.04.13 23:17, Kenneth Wolcott wrote: Hi; On Tue, Apr 13, 2010 at 19:54, Uri Guttman u...@stemsystems.com wrote: JG == Jim Gibson jimsgib...@gmail.com writes: JG On 4/13/10 Tue Apr 13, 2010 4:35 PM, Mimi Cafe mimic...@googlemail.com JG scribbled: I think this will work, but

Re: Nested if and elsif and else

2010-04-14 Thread Raymond Wan
Hi Mimi, Mimi Cafe wrote: I think this will work, but is it elegant.? If (condition){ if (nexted_condition){ As others have noted, it will work. But as for elegance, this is a very subjective opinion and contrary to what recent comments have said, my take on it is that it depends on

Nested if and elsif and else

2010-04-13 Thread Mimi Cafe
I think this will work, but is it elegant.? If (condition){ if (nexted_condition){ do this. } Elsif (nexted_condition){ Do that... } else{ Do something else. } } else{ Do something else.. } Mimi

Re: Nested if and elsif and else

2010-04-13 Thread Jim Gibson
On 4/13/10 Tue Apr 13, 2010 4:35 PM, Mimi Cafe mimic...@googlemail.com scribbled: I think this will work, but is it elegant.? Yes, it will work, and yes, it is elegant, as long as it encapsulates the logic that is required by your program. Be sure and watch your indenting, so you can

Re: Nested if and elsif and else

2010-04-13 Thread Uri Guttman
JG == Jim Gibson jimsgib...@gmail.com writes: JG On 4/13/10 Tue Apr 13, 2010 4:35 PM, Mimi Cafe mimic...@googlemail.com JG scribbled: I think this will work, but is it elegant.? JG Yes, it will work, and yes, it is elegant, as long as it encapsulates the JG logic that is required

Re: Nested if and elsif and else

2010-04-13 Thread Kenneth Wolcott
Hi; On Tue, Apr 13, 2010 at 19:54, Uri Guttman u...@stemsystems.com wrote: JG == Jim Gibson jimsgib...@gmail.com writes:  JG On 4/13/10 Tue  Apr 13, 2010  4:35 PM, Mimi Cafe mimic...@googlemail.com  JG scribbled:   I think this will work, but is it elegant.?  JG Yes, it will work, and