# Single line function with output type annotation?

**URL:** <https://discourse.julialang.org/t/single-line-function-with-output-type-annotation/34757>\
**Category:** New to Julia\
**Created:** [February 17, 2020, 2:14pm UTC](https://discourse.julialang.org/t/single-line-function-with-output-type-annotation/34757 "2020-02-17T14:14:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [February 17, 2020, 2:14pm UTC](https://discourse.julialang.org/t/single-line-function-with-output-type-annotation/34757/1 "2020-02-17T14:14:38Z")

</div>

```julia
function f(x::A{T}, y)::A{T} where {T}
    xxxx
end

```

is valid, but

```julia
f(x::A{T}, y)::A{T} where {T} = xxxx

```

is invalid as long as there’s a return type annotation (`::A{T}`). what’s the correct syntax? thanks.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [February 17, 2020, 2:19pm UTC](https://discourse.julialang.org/t/single-line-function-with-output-type-annotation/34757/2 "2020-02-17T14:19:10Z")

</div>

Add some parenthesis:

```julia
(f(x::A{T}, y)::A{T}) where {T} = T

```
