Why is this function expecting a string instead of accepting an integer?

The Dict constructor is assuming you will always use a String key and String value because that’s all you pass it. I.e. it creates a Dict{String,String}.

Replace Dict with either Dict{String,Any} or Dict{String,Union{String,Int}} depending on how narrow you can be with types on the dict values

4 Likes