# Iterator over variable number of arguments

**URL:** <https://discourse.julialang.org/t/iterator-over-variable-number-of-arguments/3558>\
**Category:** General Usage\
**Created:** [May 6, 2017, 4:23pm UTC](https://discourse.julialang.org/t/iterator-over-variable-number-of-arguments/3558 "2017-05-06T16:23:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ggggggggg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ggggggggg/32/265_2.png) [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Post date:** [May 7, 2017, 1:39am UTC](https://discourse.julialang.org/t/iterator-over-variable-number-of-arguments/3558/3 "2017-05-07T01:39:41Z")

</div>

Does this do what you want?

```julia
julia> n=3
3

julia> collect(Iterators.product([[1,-1] for i=1:n]...))
8-element Array{Tuple{Int64,Int64,Int64},1}:
 (1,1,1)   
 (-1,1,1)  
 (1,-1,1)  
 (-1,-1,1) 
 (1,1,-1)  
 (-1,1,-1) 
 (1,-1,-1) 
 (-1,-1,-1)

```

---

_[View the full topic](https://discourse.julialang.org/t/iterator-over-variable-number-of-arguments/3558)._
