Skip to content

Instantly share code, notes, and snippets.

@moustachio-belvedere
Last active December 14, 2018 10:43
Show Gist options
  • Save moustachio-belvedere/91e4d955cbb268c3ba88782a15f04d72 to your computer and use it in GitHub Desktop.
Save moustachio-belvedere/91e4d955cbb268c3ba88782a15f04d72 to your computer and use it in GitHub Desktop.
julia> dostuff(a::Real) = println(2*a);
julia> dostuff(2.0);
4.0
julia> dostuff(2);
4
julia> dostuff("2");
ERROR: MethodError: no method matching dostuff(::String)
Closest candidates are:
dostuff(::Real) at REPL[1]:1
Stacktrace:
[1] top-level scope at none:0
julia> domorestuff(a::Float64) = printlnt(2*a);
julia> domorestuff(2);
ERROR: MethodError: no method matching domorestuff(::Int64)
Closest candidates are:
domorestuff(::Float64) at REPL[5]:1
Stacktrace:
[1] top-level scope at none:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment