A variable is a container that references a physical location within main memory with a label for the information, rather than a numeric address of the memory itself.(Glenn, Dennis, 2015, p. 281)
Data Type | Definition | Examples |
---|---|---|
Integer (int) | Numeric data type for numbers without fractions | -707, 0, 707 |
Floating Point (float) | Numeric data type for numbers with fractions | 707.07, 0.7, 707.00 |
Character (char) | Single letter, digit, punctuation mark, symbol, or blank space | a, 1, ! |
String (str or text) | Sequence of characters, digits, or symbols—always treated as text | hello, +1-999-666-3333, this is a sentence |
Boolean (bool) | True or false values | 0 (false), 1 (true), false, true |
Enumerated type (enum) | Small set of predefined unique values (elements or enumerators) that can be text-based or numerical | rock (0), jazz (1) |
Array | List with a number of elements in a specific order—typically of the same type | rock (0), jazz (1), blues (2), pop (3) |
Date | Date in the YYYY-MM-DD format (ISO 8601 syntax) | 2021-09-28 |
Time | Time in the hh:mm:ss format for the time of day, time since an event, or time interval between events | 12:00:59 |
Datetime | Date and time together in the YYYY-MM-DD hh:mm:ss format | 2021-09-28 12:00:59 |
Timestamp | Number of seconds that have elapsed since midnight (00:00:00 UTC), 1st January 1970 (Unix time) | 1632855600 |