What is "variables"
To variable is a data storage location called in memory. Using variables from a computer program can store text numbers, binary data, or a combination of any of these data types. They can be transferred in code, to other functions and even other applications.
In some programming languages, variables are limited by a specific type of data. Data types vary across languages, but share many similarities.
Types of primitive data usually include:
- character, string (text)
- byte, short , integer, long (integers)
- double, decimal, float (real numbers)
- bit, Boolean (true/false)
- date
- object (any value, including the types of compounds)
Types of composite data consist of primitive types, and even other types of compounds.
# an example composite type, in pseudo code
Person(
'First name' : string,
'Surname' : string,
'Birthday' : date,
'CanProgram' : boolean
)
Some languages contain extra primitives: Tuples (Python), Linked Lists (Lisp), Hash Tables (Lisp, Perl, Python, Lua, D).
Some programming languages allow variables to store functions, which can be stored in data structures, passed as parameters to other functions, or returned as a result of other functions.
Further information and reference material on Wikipedia.