Sadly that does not work. It should return false, rather than an error
message. Use of typeof seems OK.
julia> st = "these"
"these"
julia> st <: Number
ERROR: type: subtype: expected Type{T<:Top}, got ASCIIString
julia> typeof(st) <: Number
false
On 03/24/2014 09:29 AM, Jacob Quinn wrote:
Check out issubtype:
http://docs.julialang.org/en/latest/stdlib/base/#Base.issubtype
And the corresponding operator (since it's use so much):
x = 1
x <: Real
true
On Sun, Mar 23, 2014 at 9:20 PM, cnbiz850 <[email protected]
<mailto:[email protected]>> wrote:
typeof(var) gives something too specific, like Int16, Float32,
etc. Is there a convenient way to determine if var is a number or
something else (string)? I tried isreal(var), but it gives an
error in case var is not a number.