Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Checking if variable is a type of number

$
0
0

If I want to check if a variable is a number what is a succinct way to do this?

For example I can do something like:

if typeof(x) == Int64 || typeof(x) == Float64
    #do something
else

But the above wouldn’t capture other types of Integers or Floats, e.g. Float32, etc.

Thank you for the help!

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles