function norms(v) s1 = 0.0 s2 = 0.0 sinf = 0.0 # here one can define a variable n = length(v) and then do loop in the typical way for i in 1:n, but julia also offers eachindex(v) which immediately finds the correct index for its input v. for i in eachindex(v) s1 = s1 + abs(v[i]) s2 = s2 + v[i]^2 abs_v = abs(v) if sinf < abs_v sinf = abs_v end end return s1,s2,sinf end