> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/perl6-rosettacode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/perl6-rosettacode/programming_tasks/j/jensens_device.md).

# Jensen's Device

Rather than playing tricks like Perl 5 does, the declarations of the formal parameters are quite straightforward in Raku:

```perl
sub sum($i is rw, $lo, $hi, &term) {
    my $temp = 0;
    loop ($i = $lo; $i <= $hi; $i++) {
        $temp += term;
    }
    return $temp;
}

my $i;
say sum $i, 1, 100, { 1 / $i };
```

Note that the C-style "for" loop is pronounced "loop" in Raku, and is the only loop statement that actually requires parens.
