Updated: 04/01/2018 by Computer Hope

A variable may refer to any of the following:

variable1. A variable is a value that varies.

2. With programming, a variable is a location capable of storing temporary data within a program. This data can then be modified, stored, or displayed whenever needed. For example, a program may have a variable named "$myvariable" with a value of 0 or null, and when a user enters data, the variable uses the inputted data as variable value.

Example of a variable

Below is an example of a variable in the Perl programming language.

my $myvariable = "Computer Hope";
print "There is hope, $myvariable";

In the above example, the $myvariable has an expression (value) of "Computer Hope," that is used on the next line to print "There is hope, Computer Hope" to the screen.

%1, Captured variable, Constant, Dependent variable, Environment variable, Literal, Programming terms