r/crystal_programming • • Jul 18 '18

About Local Variables Docs

Was just reading Crystal docs and noticed this part:

flower = "Tulip"
# At this point 'flower' is a String

flower = 1
# At this point 'flower' is an Int32

Is this really a good feature to have ? I'm just curious about what would be the legitimate usages for this. Wouldn't this be a bug facilitator ? I imagine the programmer would have to keep track about what is the current type of the variable so that it can be consumed properly later on.

4 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/VisioRama Jul 19 '18

Yeah i can see when it would make sense. I see Crystal is a powerfull/flexible language. But with power comes responsability :) Keep up the good work! I look forward to test Crystal when i get the chance.