aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Jacoby <jacoby.david@gmail.com>2020-11-18 12:46:57 -0500
committerDave Jacoby <jacoby.david@gmail.com>2020-11-18 12:46:57 -0500
commitfee2d4bec4c38536cdf4bde56b62f63b532b9fbf (patch)
tree4ab78a42b5705e48f49bbf010bb515026dc29508
parentf9e3e97b7962df0e9ae6248e3926be6945d8931c (diff)
downloadperlweeklychallenge-club-fee2d4bec4c38536cdf4bde56b62f63b532b9fbf.tar.gz
perlweeklychallenge-club-fee2d4bec4c38536cdf4bde56b62f63b532b9fbf.tar.bz2
perlweeklychallenge-club-fee2d4bec4c38536cdf4bde56b62f63b532b9fbf.zip
Sawyer-suggested change
-rwxr-xr-x[-rw-r--r--]challenge-087/dave-jacoby/perl/ch-1.pl11
1 files changed, 3 insertions, 8 deletions
diff --git a/challenge-087/dave-jacoby/perl/ch-1.pl b/challenge-087/dave-jacoby/perl/ch-1.pl
index 7287e80475..b2bf9721a2 100644..100755
--- a/challenge-087/dave-jacoby/perl/ch-1.pl
+++ b/challenge-087/dave-jacoby/perl/ch-1.pl
@@ -53,14 +53,9 @@ sub lsc ( @array ) {
# sequence and the current value is ready to fit into
# the current sequence.
- # I feel a little bad for not writing the correct
- # if without the else, but not _too_ bad.
- if ( !$zed->[$n][-1] || $i == $zed->[$n][-1] + 1 ) {
- # this is intentionally empty
- }
- else {
- $n++;
- }
+ # thanks to Sawyer X for the more elegent way of
+ # saying if (conditions) {} else { code }
+ ( !$zed->[$n][-1] || $i == $zed->[$n][-1] + 1 ) or $n++;
push $zed->[$n]->@*, $i;
}