diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2019-05-02 14:12:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-02 14:12:18 +0100 |
| commit | f5d13d9efa9c42729384366c7f18725a249eaf93 (patch) | |
| tree | a04903f218472e3e08138447261f0233eaf360d6 /challenge-006 | |
| parent | e13ec6b435490da7ea3b8bee5041a219b4ded85f (diff) | |
| parent | 2df07eb00f757753d1aed8e75f4579f8b54d9de7 (diff) | |
| download | perlweeklychallenge-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-x | challenge-006/simon-proctor/perl6/ch-1.p6 | 5 |
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 } } |
