Weakly typed: Make conversions between unrelated types implicitly
- C, JavaScript, Ruby, shell, PHP
- Example:
var = 21
var = var + "dot"
print(var)
Traceback (most recent call last):
File "main.py", line 2, in <module>
var = var + "dot" #type-error, string and int cannot be concatenated.
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Strongly typed: Make implicit conversions between types
- C, C++, C#, Java, Python, TypeScript
- Example:
value = 21;
value = value + "dot";
console.log(value);
21dot