Help for this page

Select Code to Download


  1. or download this
    use v6;
    my @blocks := (0..*).map: -> $n { -> $x, $y { $x * $y * $n } };
    
    say @blocks[2](2, 9);
    
  2. or download this
    sub gen($x, $y) { state $n = 0; $x*$y*$n++ }
    my @foo := &gen  xx *;
    
  3. or download this
    my @foo := sub ($x, $y) { state $n = 0; $x*$y*$n++ } xx *;
    
  4. or download this
    say @foo[2](1, 1);
    say @foo[0](1, 1);
    say @foo[5](1, 1);
    say @foo[0](1, 1);
    
  5. or download this
    0
    0
    0
    1