DATA TYPES & OPERATORS
DATA TYPES
A data type is a classification that specifies the type of data a variable can hold in a programming language
**
Common Data types are:
**
- Numbers
- Strings
- Booleans
Primitive Data types
Primitive data types are data types that represents single values
They are immutable hence values cannot be changed,however, you can reassign a new value to the variable holding the primitive data type
-They are stored by value meaning they are stored directly into a variable memory location
- Have a fixed size hence occupy a fixed amount size of memory therefore storage is in stacks
They include :
- Numbers
- strings
- boolean
Examples
Non-Primitive Data types
Non-primitive data types are more complex and can hold multiple values
- They store multiple values.
- They are modifiable and dynamic.
- They use more memory and are slower than primitive types.
- They often require additional operations (e.g., accessing elements) They include:
Objects : Collection of keys and value pairs where keys are strings and values can be of any data type
Arrays : Ordered collections of elements that can be of any data type
Functions
Maps
Sets
Top comments (0)