> 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/l/loops/for_with_a_specified_step.md).

# For with a specified step

**for(;;)** loop:

```ruby
for (var i = 2; i <= 8; i += 2) {
    say i
}
```

**for-in** loop:

```ruby
for i in (2 .. (8, 2)) {
    say i
}
```

**.each** method:

```ruby
2.to(8).by(2).each { |i|
    say i
}
```
