Warning: Method definition. Simple explanation please

EDIT: It just means that you are overwriting the method definition (a method is a function with a given combination of input argument types). You have already defined the sum(Any) method once, you now define it again (I assume you ran the code twice?). The warning is just a heads up that you are redefining the function, so you don’t do it unintentionally. It is useful because defining functions with different methods (combinations of arguments) is common in Julia, but when doing that, you may accidentallly define a new method that overwrites a previously written one. Line 3 is probably the line function sum(x).

In this case, you can ignore the warning. You will always expect method definition warnings when including a file with functions more than once.

2 Likes