Hi
A friend has written some code in a previous Julia version. I want to run it in version 1.0 but I’m getting some errors like this one:
if jbdy["installationDate"] isa Void
date_instal = NaN
end
but I get this error:
UndefVarError: Void not defined
in top-level scope at base\none
in …
What is the fault?
Don’t use 1.0, use 0.7. Julia 0.7 is basically the same thing as 1.0 but with deprecation warnings for old features, so that most old code will continue to run (warnings instead of errors). It is especially important to use 0.7 when upgrading old code.
In the case of Void
, in Julia 0.7 you will get a deprecation message indicating that it is now called Nothing
:
julia> Void
WARNING: Base.Void is deprecated, use Nothing instead.
in module Main
Nothing
That being said, rather than checking x isa Nothing
, the fastest and most idiomatic code is normally x === nothing
(yes, ===
, not ==
, for efficiency).
1 Like
Ok, thank you for the quick respons!