tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 in trackler-2.2.1.100 vs tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 in trackler-2.2.1.101
- old
+ new
@@ -1,12 +1,16 @@
-unit class Clock:ver<2>;
+unit class Clock:ver<3>;
has Int:D $.hour = 0;
has Int:D $.minute = 0;
method time {
sprintf '%02d:%02d', ($!hour + $!minute div 60) % 24, $!minute % 60;
}
method add-minutes (Int:D $min) {
$!minute += $min and return self;
+}
+
+method subtract-minutes (Int:D $min) {
+ self.add-minutes(-$min);
}