# Return type annotation with "where"

**URL:** https://discourse.julialang.org/t/return-type-annotation-with-where/3951
**Category:** General Usage
**Created:** [May 27, 2017, 2:11pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951 "2017-05-27T14:11:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [May 27, 2017, 2:11pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951/1 "2017-05-27T14:11:06Z")

</div>

Not sure if I’m doing this wrong or perhaps this hasn’t been resolved yet: I can annotate the return type or I can have “where” in the function definition but I don’t know how to have both.

```julia
struct TypeA
end
something(s::TypeA)::Int = 1 # works
somethingor(s::T) where {T} = 1 # works
somethingorother(s::T)::Int where {T} = 1 #does NOT work

```

---

<div class="post-metadata">

### Author: ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)
#### Post date: [May 27, 2017, 2:16pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951/2 "2017-05-27T14:16:44Z")

</div>

`(somethingorother(s::T)::Int) where {T} = 1 # does work`

Just add parenthesis

---

<div class="post-metadata">

### Author: ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)
#### Post date: [May 27, 2017, 2:17pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951/3 "2017-05-27T14:17:46Z")

</div>

Splendid. Thanks!

---

<div class="post-metadata">

### Author: ![rfourquet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rfourquet/32/3610_2.png) [@rfourquet](https://discourse.julialang.org/u/rfourquet)
#### Post date: [May 28, 2017, 12:13pm UTC](https://discourse.julialang.org/t/return-type-annotation-with-where/3951/4 "2017-05-28T12:13:54Z")

</div>

See also [https://github.com/JuliaLang/julia/issues/21847](https://github.com/JuliaLang/julia/issues/21847).
