Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created January 25, 2010 22:03
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 ashgti/286309 to your computer and use it in GitHub Desktop.
Save ashgti/286309 to your computer and use it in GitHub Desktop.
class Foo {
has @.internal;
method each (&block) {
my $i = 0;
loop {
last if $i >= +@.internal;
&block(@.internal[$i]);
$i++;
};
say 'done interating';
}
}
my $a = Foo.new(internal => (1, 2, 3));
$a.each(-> $a {
say $a;
});
# vim: ft=perl6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment