julia> function step_function(x)
if x > 0
return 1
eles
return 0
end
end
step_function (generic function with 1 method)
julia> x = [-1.0, 1.0, 2.0]
3-element Array{Float64,1}:
-1.0
1.0
2.0
julia> [step_function(i) for i in x]
3-element Array{Union{Nothing, Int64},1}:
nothing
1
1
I think this is wrong output. is Right output that:
3-element Array{Int64,1}:
0
1
1
Why first output is nothing
? this is my question.