Hello,
Why is the following combination wrong?
w = "Hello"
print(parse(Int,length(w)))
Thank you.
Hello,
Why is the following combination wrong?
w = "Hello"
print(parse(Int,length(w)))
Thank you.
length(w)
is already an integer, you don’t need to parse
it.
Hi,
Thanks.
So, when we try to convert one type to the same type, we get an error.
convert
is different, convert(::Type{T}, x::T} -> x
is generically defined, so you can convert(Int, 2)
. However, parse
is something you specifically do to string-ly values, hence the error you saw.
Hi,
Thank you so much for your reply.
I didn’t mean the convert
function.