in reply to Simplify code in Perl with "unless" condition
unless (...) is the equivalent of if (not (...)) - it only simplifies your code if it makes it more readable. For example, you might find next LINE unless format_is_ok($line); more readable than next LINE if !format_is_ok($line);. When in doubt, stick with if. Also, unless is a conditional statement like if, not a "loop".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simplify code in Perl with "unless" loop -- De Morgan's laws
by Discipulus (Canon) on May 28, 2016 at 12:50 UTC | |
|
Re^2: Simplify code in Perl with "unless" loop
by Chaoui05 (Scribe) on May 27, 2016 at 15:42 UTC | |
by Marshall (Canon) on May 27, 2016 at 15:59 UTC | |
by Chaoui05 (Scribe) on May 27, 2016 at 16:28 UTC |