I’m trying to create a function that is having 2 input parameters of generic type T as below:
T
function mysum(x::T, y::T) x+y end
but I got:
ERROR: UndefVarError: T not defined
You need
function mysum(x::T, y::T) where T x+y end
See Methods · The Julia Language.