Skip to main content

Variable

Definition:
A named storage location in memory for data, which has a type.


Detailed Explanation

  • A variable represents a named reference to a value in memory.
  • It allows programs to store, retrieve, and manipulate data.
  • Variables must usually be declared before use, with their type defining what values they can hold.
  • Common pitfalls include using uninitialized variables or assuming they hold data after scope ends.

Example

// Example of declaring and using a variable in a generic language // let age = 25; // print(age);


⬅ Back