In programming languages, there are two kinds of typing, i.e. assigning a datatype to a variable: static and dynamic. More traditional languages such as Pascal, C, Ada and Java require the programmer to assign a type to a variable before it can be used. For example in C:
double aNumber;
This makes the variable aNumber, a type double, meaning that it can store double-precision floating point numbers – not anything else. This is called static typing, and really means that type checking occurs when the program is compiled. Languages such as Python, Perl, and Julia use something often called dynamic typing, where the type is assigned when a variable is created or used. In dynamic typing, type checking occurs at runtime. For example in Julia:
aNumber = 'hello' aNumber = 47
The first assignment makes the variable aNumber a string, and the following one makes it an integer. This means that a variable doesn’t really have a fixed type.
What sets them apart? Many would argue that statically typed languages are more robust – dynamically typed languages are touted to behave more erratically, with run-time errors, and a difficulty in achieving the same level of correctness. The single biggest benefit of dynamic typing is that for the novice programmer there is a very shallow learning curve. There is no type system (although some languages also allow variables to be typed if required), and therefore no other dependencies, such as I/O. For example, C requires the following types of integers:
int, unsigned int short, unsigned short long, unsigned long long long, unsigned long long
This can be overwhelming for the novice programmer to remember, considering the actually value range of each is based on the particular system the C compiler is on, and then to have to deal with specific type codes for I/O, e.g. %d for int, %ld for long etc.