I do not know what to write in the title…

I am learning a lot by analyzing source codes in Julia packages I am using.

Today, I saw an interesting line in lm.jl in the GLM package.

```
function deviance(r::LmResp)
y = r.y
mu = r.mu
wts = r.wts
v = zero(eltype(y)) + zero(eltype(y)) * zero(eltype(wts))
if isempty(wts)
@inbounds @simd for i = eachindex(y,mu)
v += abs2(y[i] - mu[i])
end
else
@inbounds @simd for i = eachindex(y,mu,wts)
v += abs2(y[i] - mu[i])*wts[i]
end
end
v
end
```

My question is in the fifth line. Why did the authors write such a line instead of `v = 0`

or `v = 0.`

?

Is it for aiding type inference? Then, can it be replaced with `v = zero(eltype(y))*zero(eltype(wts))`

?