julia> module D b = a # errors as D's global scope is separate from A's end; ERROR: UndefVarError 例如,此处z未引入顶级范围: julia> for i = 1:10 z = i end julia> z ERROR: UndefVarError: z not 类型或宏定义内部使用的变量的赋值不必先于其内部使用: julia> f = y -> y + a (::#1) (generic function with 1 method) julia> f(3) ERROR: UndefVarError println("z: $z") # errors as z has not been assigned yet but is local end x: 1, y: -1 ERROR: UndefVarError
julia> test(2,1) ERROR: UndefVarError: relation not defined Stacktrace: [1] test(::Int64, ::Int64) at 您将需要一个新的交互式会话实例或一个不同的变量名称来对此进行测试: julia> for j = 1:5 println(j) end 1 2 3 4 5 julia> j ERROR: UndefVarError ReadOnlyMemoryError RemoteException MethodError OverflowError ParseError SystemError TypeError UndefRefError UndefVarError Exception true julia> typeof(DomainError) <: Exception false 此外,某些异常类型采用一个或多个用于错误报告的参数: julia> throw(UndefVarError (:x)) ERROR: UndefVarError: x not defined 遵循以下UndefVarError编写方式,可以通过自定义异常类型轻松实现此机制: julia> struct MyUndefVarError
01 julia> x[1] = NA 02 Error: UndefVarError: NA not defined 03 while loading In[2], in expression
tryparse, tuple, TypeError, typeintersect, typejoin, typemax, typemin, typeof, U ucfirst, UndefRefError, UndefVarError