Do you put return type in function definitions?

Do you have any opinion about annotating function definitions with return types? Like it or not and why?

Here’s a dummy example:

add(x, y)::Int = x + y

It gives additional type checking:

julia> add(1,2)
3

julia> add(1.0,2)
3

julia> add(1.1, 2)
ERROR: InexactError: Int64(3.1)
4 Likes