aboutsummaryrefslogtreecommitdiff
path: root/challenge-006
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-05-02 14:12:18 +0100
committerGitHub <noreply@github.com>2019-05-02 14:12:18 +0100
commitf5d13d9efa9c42729384366c7f18725a249eaf93 (patch)
treea04903f218472e3e08138447261f0233eaf360d6 /challenge-006
parente13ec6b435490da7ea3b8bee5041a219b4ded85f (diff)
parent2df07eb00f757753d1aed8e75f4579f8b54d9de7 (diff)
downloadperlweeklychallenge-club-f5d13d9efa9c42729384366c7f18725a249eaf93.tar.gz
perlweeklychallenge-club-f5d13d9efa9c42729384366c7f18725a249eaf93.tar.bz2
perlweeklychallenge-club-f5d13d9efa9c42729384366c7f18725a249eaf93.zip
Merge pull request #114 from Scimon/master
Handle a case where the range start and finish differ by one
Diffstat (limited to 'challenge-006')
-rwxr-xr-xchallenge-006/simon-proctor/perl6/ch-1.p65
1 files changed, 4 insertions, 1 deletions
diff --git a/challenge-006/simon-proctor/perl6/ch-1.p6 b/challenge-006/simon-proctor/perl6/ch-1.p6
index 00dca1a540..6d3c0f0715 100755
--- a/challenge-006/simon-proctor/perl6/ch-1.p6
+++ b/challenge-006/simon-proctor/perl6/ch-1.p6
@@ -12,7 +12,10 @@ class GrowableRange {
method grow() { $!max++; return self }
- method gist() { $!min == $!max ?? $!min.Str !! "{$!min}-{$!max}" }
+ method gist() { $!min == $!max ??
+ $!min.Str !! $!max == $!min+1 ??
+ "{$!min},{$!max}"
+ !! "{$!min}-{$!max}" }
method Str() { self.gist }
}