Return (1,), what is the meaning?

I am new to Julia. The following code is from some people’s package:

function apply_column!(::IsDeterministic, w, op::AbstractMatrix, add, val, boost=1)
w .+= op[:, add] .* val
return (1,)
end

What does

return (1,)

mean? The comma looks quite strange to me.

(1,) is a tuple with 1 inside it. Same as tuple(1).

is the way you return a Tuple with 1 element. The comma is used to distinguish a Tuple from just 1 surrounded by parenthesis. I.e:

(1) == 1

but

(1,) != 1

and

julia> typeof( (1,) )
Tuple{Int64}
4 Likes