Types must be first defined then called in a module? Why?

WuSiren
Tue, 21 May 2024 08:22:05 +0000
General Usage

module MyModule

function myfun(t::MyType)
    println(plusone(t.x))
end

struct MyType
    x::Float64
end

function plusone(x)
    x + 1
end

end

ERROR: UndefVarError: `MyType` not defined

8 posts - 3 participants