Skip to content

Instantly share code, notes, and snippets.

@mrkaspa
Created February 23, 2019 17:54
Show Gist options
  • Save mrkaspa/bc7658af68ed38e53dd57881693e0e63 to your computer and use it in GitHub Desktop.
Save mrkaspa/bc7658af68ed38e53dd57881693e0e63 to your computer and use it in GitHub Desktop.
struct Solution
res::Union{Int64, Nothing}
end
function ex_div(a, b)::Solution
if b == 0
Solution(nothing)
else
Solution(Int64(a / b))
end
end
result = ex_div(10, 0)
if isnothing(result.res)
println("Nothing")
else
println(result.res)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment