All ways to define functions in Julia?

What about this one?

function fn_generator()
    if true
        f() = 0
    else
        f(x, y) = x+y
    end
end

name = fn_generator()

name(1,2)   # 3