I’m reading in some environment variables and sometimes I need to get Inf
.
Obviously Inf
is not an Int
, but can I do something like:
arc_nu = parse(Int,ENV["ARCNU"]) # where ENV["ARCNU"] = "Inf"
@test isinf(arc_nu) == true
I’m reading in some environment variables and sometimes I need to get Inf
.
Obviously Inf
is not an Int
, but can I do something like:
arc_nu = parse(Int,ENV["ARCNU"]) # where ENV["ARCNU"] = "Inf"
@test isinf(arc_nu) == true
parse(Float64, "Inf")
or
x = ENV["ARCNU"]; x == "Inf" ? Inf : parse(Int, x)
or
x = ENV["ARCNU"]; x == "Inf" ? typemax(Int) : parse(Int, x)
thanks, the ternary actually works much better for me here