Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Please use this tag in the context the teaching of computer science, where a variable may be thought of as a storage location paired with an identifier (a name) which holds a value that can be retrieved by referencing the name. Do not use in the context of mathematics, where a variable is an unknown to be solved for.

The term "variable" has many meanings. In particular the meaning in mathematics is distinct from that in computer science. In mathematics, variables are also called "unknowns" and are typically used to define functions or to specify values through equations. In computer science, however, the term generally means an association between a name and a value where the value associated may vary over time. Often the term refers to a named memory location, but there are other consistent notions as well. In math, variables don't actually vary.

Use this tag for questions relating to teaching the CS concept of variable including representation. The tag is also suitable for questions related to the different notions of "variable" in different languages. For example, in Scheme, the notion is closer to that of mathematics than is the case with C.

history | excerpt history