File tree Expand file tree Collapse file tree 1 file changed +0
-9
lines changed Expand file tree Collapse file tree 1 file changed +0
-9
lines changed Original file line number Diff line number Diff line change @@ -184,22 +184,13 @@ meaning that it is unconstrained since all values in Julia are instances of the
184
184
julia> f(x,y) = println("Whoa there, Nelly.")
185
185
f (generic function with 3 methods)
186
186
187
- julia> methods(f)
188
- # 3 methods for generic function "f":
189
- [1] f(x::Float64, y::Float64) in Main at none:1
190
- [2] f(x::Number, y::Number) in Main at none:1
191
- [3] f(x, y) in Main at none:1
192
-
193
187
julia> f("foo", 1)
194
188
Whoa there, Nelly.
195
189
```
196
190
197
191
This catch-all is less specific than any other possible method definition for a pair of parameter
198
192
values, so it will only be called on pairs of arguments to which no other method definition applies.
199
193
200
- Note that in the signature of the third method, there is no type specified for the arguments ` x ` and ` y ` .
201
- This is a shortened way of expressing ` f(x::Any, y::Any) ` .
202
-
203
194
Although it seems a simple concept, multiple dispatch on the types of values is perhaps the single
204
195
most powerful and central feature of the Julia language. Core operations typically have dozens
205
196
of methods:
You can’t perform that action at this time.
0 commit comments