# This if statements is not work properly

**URL:** <https://discourse.julialang.org/t/this-if-statements-is-not-work-properly/33019>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [January 6, 2020, 6:37am UTC](https://discourse.julialang.org/t/this-if-statements-is-not-work-properly/33019 "2020-01-06T06:37:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dialektike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dialektike/32/12141_2.png) [@dialektike](https://discourse.julialang.org/u/dialektike)\
**Post date:** [January 6, 2020, 6:37am UTC](https://discourse.julialang.org/t/this-if-statements-is-not-work-properly/33019/1 "2020-01-06T06:37:17Z")

</div>

```julia
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:

```julia
3-element Array{Int64,1}:
 0
 1
 1

```

Why first output is `nothing`? this is my question.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [January 6, 2020, 6:41am UTC](https://discourse.julialang.org/t/this-if-statements-is-not-work-properly/33019/2 "2020-01-06T06:41:13Z")

</div>

You’ve got a typo there - I think it should be `else`, not `eles`. As you’ve written it, everything between `if` and `end` is part of the if block. Since the branch in there isn’t taken, the last value will be returned by default, which in this case is `nothing`.

---

<div class="post-metadata">

**Author:** ![dialektike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dialektike/32/12141_2.png) [@dialektike](https://discourse.julialang.org/u/dialektike)\
**Post date:** [January 6, 2020, 6:54am UTC](https://discourse.julialang.org/t/this-if-statements-is-not-work-properly/33019/3 "2020-01-06T06:54:07Z")

</div>

OHH!! think you!! my elementary mistake!
