myhash : Hash(String, String ????? ) = { "name" => "test, "age" => 99}
puts myhash
i want the word age
to be a string but its value should be number
how ?
myhash : Hash(String, String ????? ) = { "name" => "test, "age" => 99}
puts myhash
i want the word age
to be a string but its value should be number
how ?
You could do
myhash : Hash(String, String | Int32) = {"name" => "test", "age" => 99}
puts myhash
You could also do this to get the type of the literal:
puts typeof({"name" => "test", "age" => 99})
doesn’t work my mate
How doesn’t it work? Can you give me an error message?
sorry it works