Variable
A variable is a named location that holds a value.
Related concepts: NameValueAssignment
Closest Wikipedia entry: Variable (computer science)
Misconceptions about Variable35 documented Misconceptions
Check YourselfAssignmentCopiesObject — Java
Assignment copies the objectCallerFrameContainsCalleeFormal — Java
Stack frame of caller includes variables for callee's formal parametersControlledLocalAccess — 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 loopLocalVariablesAutoInitialized — 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 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 variablesReferenceToVariable — Java
References can point to variablesThisAsField — Java
this is a special field in the objectThisAssignable — Java
One can assign to thisThisExistsInStaticMethod — Java
this is a local variable, also in static methodsUndeclaredVariables — Java
Variables can be used even without being declared beforehandUntypedVariables — 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 variableVariablesHoldObjects — Java
A variable of a reference type contains a whole objectAssignmentCopiesObject — JavaScript
Assignment copies the objectConstDeclarationCanBeLeftUninitialized — JavaScript
Declarations of constants do not need to be immediately initializedNoAtomicExpression — JavaScript
Expressions must consist of more than one pieceThisAssignable — JavaScript
One can assign to thisAssignmentCopiesObject — Python
Assignment copies the objectNoAtomicExpression — Python
Expressions must consist of more than one pieceSelfAssignable — Python
Reassigning self changes the object on which a method is calledVariablesHoldExpressions — Python
= stores an expression: it stores a reference to the expression in a variableVariablesHoldObjects — Python
A variable contains a whole objectExpressionAssigns — Scratch
An expression that reads a variable also updates its value after the evaluationResetStateEachProgramExecution — Scratch
Running a Scratch program first resets the state of the world and then executes the program