# "?" expression error message is not unambiguous

**URL:** https://discourse.julialang.org/t/expression-error-message-is-not-unambiguous/11994
**Category:** General Usage
**Created:** [June 27, 2018, 11:51am UTC](https://discourse.julialang.org/t/expression-error-message-is-not-unambiguous/11994 "2018-06-27T11:51:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jraikisto](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jraikisto](https://discourse.julialang.org/u/jraikisto)
#### Post date: [June 27, 2018, 11:51am UTC](https://discourse.julialang.org/t/expression-error-message-is-not-unambiguous/11994/1 "2018-06-27T11:51:36Z")

</div>

`k = x -> x > 5 ? "foo" : "bar"`  
works perfectly fine, but  
`k = x -> x > 5 ? return "foo" : return "bar"`  
returns  
`ERROR: syntax: colon expected in "?" expression`

I’m running julia 0.6.2.

I just spent 10 minutes wondering if my “:” is colon or some other random character which looks just like colon. I know ? expression doesn’t allow statements, but error message could be clearer.

---

<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: [June 27, 2018, 12:01pm UTC](https://discourse.julialang.org/t/expression-error-message-is-not-unambiguous/11994/2 "2018-06-27T12:01:51Z")

</div>

> [@jraikisto](#):
>
> I know ? expression doesn’t allow statements

Isn’t this just the parser being too eager? Eg

```julia
julia> true ? (return "foo") : return "bar"
"foo"

```
