Skip to content

Instantly share code, notes, and snippets.

@hoelzro
Created July 5, 2012 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoelzro/3052303 to your computer and use it in GitHub Desktop.
Save hoelzro/3052303 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use v6;
class Counter {
has $!n;
method new($n) {
return self.bless(*, :$n);
}
method is-counting {
return $!n > 0;
}
method tick {
$!n--;
}
}
my $c = Counter.new(10);
while $c.is-counting {
say $c.tick;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment