(v1.11) julia> a::Real = 0
0
(v1.11) julia> a
0
(v1.11) julia> typeof(a)
Int64
?????
Real is an abstract type, you can't have instances of abstract type. Maybe you want to elaborate on what you want to achieve
Mosè Giordano said:
Real is an abstract type, you can't have instances of abstract type. Maybe you want to elaborate on what you want to achieve
Ah that explains it. Only instantiate with a concrete type.
specifically,
julia> a::Real = 0
0
julia> a isa Real
true
holds.
julia> Int <: Real
true
Int
is a subtype of Real
Last updated: Nov 06 2024 at 04:40 UTC