> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/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/sidef-lang/programming_tasks/j/jensens_device.md).

# Jensen's Device

```ruby
var i
func sum (i, lo, hi, term) {
    var temp = 0
    for (*i = lo; *i <= hi; (*i)++) {
        temp += term.run
    }
    return temp
}
say sum(\i, 1, 100, { 1 / i })
```

#### Output:

```
5.18737751763962026080511767565825315790897212671
```
