Guest User

Untitled

a guest
Dec 14th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. julia> dostuff(a::Real) = println(2*a);
  2.  
  3. julia> dostuff(2.0);
  4. 4.0
  5.  
  6. julia> dostuff(2);
  7. 4
  8.  
  9. julia> dostuff("2");
  10. ERROR: MethodError: no method matching dostuff(::String)
  11. Closest candidates are:
  12. dostuff(::Real) at REPL[1]:1
  13. Stacktrace:
  14. [1] top-level scope at none:0
  15.  
  16. julia> domorestuff(a::Float64) = printlnt(2*a);
  17.  
  18. julia> domorestuff(2);
  19. ERROR: MethodError: no method matching domorestuff(::Int64)
  20. Closest candidates are:
  21. domorestuff(::Float64) at REPL[5]:1
  22. Stacktrace:
  23. [1] top-level scope at none:0
Add Comment
Please, Sign In to add comment