Variable
A variable is a named location that holds a value.
Related concepts: NameValueAssignment
Closest Wikipedia entry: Variable (computer science) — In computer programming, a variable is an abstract storage location paired with an associated symbolic name, which contains some known or unknown quantity of information referred to as a value; or in simpler terms, a variable is a named container for a particular set of bits or type of data (like integer, float, string etc...). A variable can eventually be associated with or identified by a memory address. The variable name is the usual way to reference the stored value, in addition to referring to the variable itself, depending on the context.
Misconceptions about Variable35 documented Misconceptions
Check YourselfAssignmentCopiesObject — Java
Assignment copies the objectAssignmentCopiesObject — JavaScript
Assignment copies the objectAssignmentCopiesObject — Python
Assignment copies the objectCallerFrameContainsCalleeFormal — Java
Stack frame of caller includes variables for callee's formal parametersConstDeclarationCanBeLeftUninitialized — JavaScript
Declarations of constants do not need to be immediately initializedControlledLocalAccess — Java
One can control access to local variables using access modifiersExpressionAssigns — Java
An expression that reads a variable also updates its value after the evaluationForEachIteratesOverIndices — Java
An enhanced for loop iterates over the indices of an array or a collectionForEachVariableIsElement — Java
One can assign to the variable of an enhanced for statement to store a value in the corresponding array or collection elementForVariableScopeBeyondLoop — Java
The scope of variables declared in a for loop header extends beyond the loopInlineVariableInExpressionTree — Java
The expression tree of an expression involving a variable inlines the variable's definitionLocalVariablesAutoInitialized — Java
Local variables are automatically initializedLoopBodyScopeImpliesLoopLifetime — Java
Lifetime of variables declared in a loop body extends across all loop iterationsMultiReferenceVariable — Java
A reference variable can point to multiple objectsMultiValueVariable — Java
A variable can contain more than one valueMustInitializeFieldInConstructor — Java
Constructors must assign values to all fieldsNoAtomicExpression — Java
Expressions must consist of more than one pieceNoAtomicExpression — JavaScript
Expressions must consist of more than one pieceNoAtomicExpression — Python
Expressions must consist of more than one pieceNoCastIfSameSize — Java
If a variable is at least as big (bit-width) as a value, then no cast is needed to a assign the value to the variableNoLocalVariables — Java
There are no local variablesObjectLabeledWithVariableName — Java
In stack and heap diagrams, an object on the heap is labeled with the name of the variable that refers to itReferenceLabeledWithDynamicType — Java
In stack and heap diagrams, reference variables are labeled with the types of the objects they refer toReferenceToVariable — Java
References can point to variablesThisAsField — Java
this is a special field in the objectThisAssignable — Java
One can assign to thisThisAssignable — JavaScript
One can assign to thisThisExistsInStaticMethod — Java
this is a local variable, also in static methodsUndeclaredVariables — Java
Variables don't need to be declaredUntypedVariables — Java
Variable declarations don't need a typeUseOfSelfTypeImpliesRecursiveType — Java
If a class has a method that has a local variable, parameter, or return value with the class as its type, the class is a recursive typeVariablesHoldExpressions — Java
= stores an expression in a variableVariablesHoldExpressions — Python
= stores an expression: it stores a reference to the expression in a variableVariablesHoldObjects — Java
A variable of a reference type contains a whole objectVariablesHoldObjects — Python
A variable contains a whole object