From 2df07eb00f757753d1aed8e75f4579f8b54d9de7 Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Thu, 2 May 2019 14:03:39 +0100 Subject: Handle a case where the range start and finish differ by one --- challenge-006/simon-proctor/perl6/ch-1.p6 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 } } -- cgit