In programming, datatype is the classification of a particular type of information
A data type constrains the values that an expression, such as a variable or a function might take
This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored
It might be associated to a variable or a value
For example, in Python it is associated with the values
The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another:
These are also called as primitive data types
Composite types are derived from one or more primitive type
For example array
, set
, object
etc
Some composite data types might also be allowed to contain other composite types, based on the programming language
A strongly typed language requires the programmer to declare the data type of every data object or variable
For example, in Java every variable or function has to be associated with a datatype during its declaration
If a function doesn't return a value then it is of void
data type
In a dynamically typed language, the data type of a variable is assigned by the programming language during its runtime (i.e. when the program is being run)
In such case, a variable can be assigned to a value of any datatype