# Line breaks in comprehension syntax

**URL:** <https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800>\
**Category:** General Usage\
**Created:** [January 31, 2017, 1:25pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800 "2017-01-31T13:25:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [January 31, 2017, 1:25pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800/1 "2017-01-31T13:25:37Z")

</div>

The following gives a syntax error, is this intended? It seems to me as the most natural way to break long comprehensions into several lines:

```julia
x = randn(100)
[x[i]
 for i in 1:100 
 if x[i] < 0.5]

syntax: expected "]"

```

---

<div class="post-metadata">

**Author:** ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Post date:** [January 31, 2017, 1:30pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800/2 "2017-01-31T13:30:48Z")

</div>

Your example works in v0.6.

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [January 31, 2017, 1:32pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800/3 "2017-01-31T13:32:42Z")

</div>

great, I didn’t try that before.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 31, 2017, 2:42pm UTC](https://discourse.julialang.org/t/line-breaks-in-comprehension-syntax/1800/4 "2017-01-31T14:42:30Z")

</div>

In the meantime,

```julia
[x[i]
 for i in 1:100 if
 x[i] < 0.5]

```

is a workaround on `0.5.0`.
