Value
From Coderwiki
More actions
A value is a fundamental concept representing a specific piece of data that can often be manipulated by a program. It is the actual data itself, as opposed to the variable, which is a named container or reference that holds a value. Values are the most basic units of information processed by a program.
Attributes
edit edit sourceValues usually have:
- A type (e.g., integer, string, boolean, other object)
- Some data content (the actual bits representing the data, according to its type)
Values can be mutable, meaning their data can be changed after assignment, or immutable, meaning their data cannot be changed after assignment.
Evaluation
edit edit sourceIn an expression, variables and function calls are evaluated to produce a value before the operation is performed:
int a = 10; // evaluated to the value 10 then assigned to 'a'
int b = 20; // evaluated to the value 20 then assigned to 'a'
int c = a + b; // evaluated to the value 30 THEN assigned to 'c'