使用 using ProgressMeter
的 for 循环:
function test()
@showprogress 1 "Computing..." for n in 3:5:20
print()
end
end
我不理解为什么
@code_warntype test()
在三行上返回类型警告,更重要的是如何解决它: %18 = φ (#2 => %12, #3 => %14)::Union{Nothing, Tuple{Int64,Int64}}
Union{Missing, X}
或Union{Nothing, X}
。其它故意返回联合类型的例子包括find*
系列函数。参见 https://julialang.org/blog/2018/08/union-splitting - fredrikekre