From 741e5fa1c2b35f7e80eb9a3b2b49b36e74ee6e1b Mon Sep 17 00:00:00 2001 From: habere-et-dispertire Date: Sun, 5 Dec 2021 21:01:49 +0000 Subject: [PATCH] [Fence post error] Correct number of times seen When the number of times seen is three or more, then the reported value is one too little. --- exercises/associatives/seen-before.raku | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exercises/associatives/seen-before.raku b/exercises/associatives/seen-before.raku index 440f5c935..b699f0d51 100644 --- a/exercises/associatives/seen-before.raku +++ b/exercises/associatives/seen-before.raku @@ -1,8 +1,12 @@ my %seen; loop { my $word = prompt 'Word: '; - if %seen{$word} { - say %seen{$word} == 1 ?? 'Seen!' !! say "Seen %seen{$word} times!"; - } %seen{$word}++; + + if %seen{$word} == 2 { + say 'Seen!'; + } + elsif %seen{$word} >= 3 { + say "Seen %seen{$word} times!"; + } }