in reply to A newbie's first try at conditionals
Instead of having the conditional all on the one line, like if (($Age < 13) && ($Age > 0)) I try to space things out, like:
This makes a visual scan of the whole if - elsif - else block easier. Once it all works, you cansquash the lines up if you wish.if (($Age < 13) && ($Age > 0) ) { some block of statements; } elsif (($Age < 18) && ($Age > 12)) ) { another block of statements; } else { a final block; }
Once you start to get into complex data structures then this can solve a lot of stilly typographical erors.
|
|---|