Importance of Data Type

The data type is also important for another reason: certain types of operations can only be performed on certain data types. For example, before you can perform addition, subtraction, or multiplication on a variable, it must be a numeric data type. This allows the compiler and runtime engine to treat the variable as a number and perform mathematical operations on it. By declaring a variable with one of the numeric data types, you ensure that only numbers will be stored in it, and you can perform mathematical operations on that variable without having to worry about whether the variable actually has a numerical value.

First
Next