# Typing by value

I wondered if there was a generalized name for typing a variable by assigning a specific value to it. For instance

  a = 4


This would make the variable a an integer, since 4 is an integer. Likewise

  b = 0.8


is b a float in this instance.

Technically this is not dynamic typing (since there is only one defined type, it is just written as the value), but then how is this form called?

• en.wikipedia.org/wiki/Type_inference – JimN Dec 14 '17 at 23:17
• Note that things may not always be a clear-cut as you think. Why int and not long, short, or double here? Implementations and answers differ between languages. – Raphael Dec 15 '17 at 11:10