# Is there an idiomatic way to iterate over all binary strings of a given length?

**URL:** <https://discourse.julialang.org/t/is-there-an-idiomatic-way-to-iterate-over-all-binary-strings-of-a-given-length/35487>\
**Category:** New to Julia\
**Created:** [March 3, 2020, 10:11pm UTC](https://discourse.julialang.org/t/is-there-an-idiomatic-way-to-iterate-over-all-binary-strings-of-a-given-length/35487 "2020-03-03T22:11:31Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![lesshaste](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lesshaste/32/12302_2.png) [@lesshaste](https://discourse.julialang.org/u/lesshaste)\
**Post date:** [March 4, 2020, 12:32pm UTC](https://discourse.julialang.org/t/is-there-an-idiomatic-way-to-iterate-over-all-binary-strings-of-a-given-length/35487/11 "2020-03-04T12:32:08Z")

</div>

I guess if I update the strings in Gray code order then I only need to change one entry at a time which could be very fast.

I need strings as I am computing various distances between them. For example the Levenshtein distance.

---

_[View the full topic](https://discourse.julialang.org/t/is-there-an-idiomatic-way-to-iterate-over-all-binary-strings-of-a-given-length/35487)._
