# Print elements of vector without the braces

**URL:** https://discourse.julialang.org/t/print-elements-of-vector-without-the-braces/62269
**Category:** General Usage
**Tags:** question
**Created:** [June 2, 2021, 12:00pm UTC](https://discourse.julialang.org/t/print-elements-of-vector-without-the-braces/62269 "2021-06-02T12:00:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [June 2, 2021, 12:00pm UTC](https://discourse.julialang.org/t/print-elements-of-vector-without-the-braces/62269/1 "2021-06-02T12:00:01Z")

</div>

Many times I want to output a simple data table from a vector, like in this MWE:

```julia
julia> for i in 1:5
         println(rand(3))
       end
[0.6125928743733668, 0.36073254544716105, 0.5008360754548771]
[0.04295309867553865, 0.2695746137499093, 0.8300907403333446]
[0.583606126726895, 0.35685598691093867, 0.6457105731760235]
[0.2378687372009609, 0.9417391680121274, 0.7781190880491764]
[0.5099446049834098, 0.5874226809107426, 0.12270964644338145]

```

I would like to print that without the braces and the commas. Like this:

```julia
julia> for i in 1:5
         x = rand(3)
         for v in x
           print("$v ")
         end
         print("\n")
       end
0.2651120847888846 0.318163694284342 0.2106114829636947 
0.2938839408544498 0.2645723271091036 0.993859969760363 
0.0921973200585453 0.6385938138072869 0.13466907347686785 
0.7716713510203739 0.2821766396139149 0.5727765718922624 
0.31251479998055776 0.5274458513709515 0.8257634367657791 

```

(most commonly to a file, but that is not the point).

Is there a one-liner simple notation for that? The problem is that this prints the generator instead of the actual data:

```julia
julia> x = rand(3)
       println("$v " for v in x) 
Base.Generator{Vector{Float64}, var"#1#2"}(var"#1#2"(), [0.5117878075322972, 0.7627506311079011, 0.5697925099293792])

```

and if I collect I get back to the original problem.

(now one related curiosity: an iterator like `for v in x` guarantees that the elements will be iterated in the order of their indexes in `x`?)

---

<div class="post-metadata">

### Author: ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)
#### Post date: [June 2, 2021, 12:16pm UTC](https://discourse.julialang.org/t/print-elements-of-vector-without-the-braces/62269/2 "2021-06-02T12:16:38Z")

</div>

```julia
julia> println(["$v " for v in x]...)
0.1694754493026882 0.37535640634785317 0.18388664162907942

julia> println(join(x, " "))
0.1694754493026882 0.37535640634785317 0.18388664162907942

```
