Skip to content

Instantly share code, notes, and snippets.

@zoffixznet

zoffixznet/p6.p6 Secret

Created September 26, 2018 16:25
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 zoffixznet/55c8198c63177a9729be75ec7c61afde to your computer and use it in GitHub Desktop.
Save zoffixznet/55c8198c63177a9729be75ec7c61afde to your computer and use it in GitHub Desktop.
class Point {
has $!x;
has $!y;
}
my int $total := 0;
my int $i;
while ++$i <= 1_000_000 {
my $p := Point.new(x => 2, y => 3);
$total := $total + nqp::getattr($p, Point, '$!x') + nqp::getattr($p, Point, '$!y');
}
say($total);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment