 Local variables Local variables start with lowercase letters. They are declared when you first assign them a value. name = "Crystal"
age = 1
 Their type is inferred from their usage, not only from their initializer. In general, they are just value holders associated with the type that the programmer expects them to have according to their location and usage on the program. For example, reassigning a variable with a different expression makes it have that expression’s type: flower = "Tulip"
# At this point 'flower' is a String

flower = 1
# At this point 'flower' is an Int32
 Underscores are allowed at the beginning of a variable name, but these names are reserved for the compiler, so their use is not recommended (and it also makes the code uglier to read).

    To the extent possible under law, the persons who contributed to this workhave waivedall copyright and related or neighboring rights to this workby associating CC0 with it.
https://crystal-lang.org/reference/1.6/syntax_and_semantics/local_variables.html


{'path': 'public/docs/crystal/syntax_and_semantics/local_variables.html', 'source': 'DevDocs.IO'}