# How to restrict an iteration with StepRange?

**URL:** <https://discourse.julialang.org/t/how-to-restrict-an-iteration-with-steprange/17598>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [November 16, 2018, 2:59pm UTC](https://discourse.julialang.org/t/how-to-restrict-an-iteration-with-steprange/17598 "2018-11-16T14:59:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [November 16, 2018, 4:33pm UTC](https://discourse.julialang.org/t/how-to-restrict-an-iteration-with-steprange/17598/3 "2018-11-16T16:33:11Z")

</div>

Somewhat relatedly, check out [RFC: jumping in iterators](https://discourse.julialang.org/t/rfc-jumping-in-iterators/15235).

You can always do `collect(s)[R]`. It’s not optimal, but you don’t always need optimal 🙂

---

_[View the full topic](https://discourse.julialang.org/t/how-to-restrict-an-iteration-with-steprange/17598)._
