You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declaring local variables with a type seems to be a new feature, which might explain this odd behaviour below. It appears when a double splat is used in the method and the same Symbol for a key (e.g. place) is used for a local variable with a declared type:
defshow(**attrs)
place : String="w"# Not recommended practice at the moment.puts place
end
show(name:"Bobby") # This works.
show(name:"Bobby", place:"World") # This fails:##in tmp.cr:2: variable 'place' already declared## place : String = "w"# ^~~~~
Declaring local variables with a type seems to be a new feature, which might explain this odd behaviour below. It appears when a double splat is used in the method and the same Symbol for a key (e.g.
place
) is used for a local variable with a declared type:(Originally posted on stackoverflow)
The text was updated successfully, but these errors were encountered: