Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Variable"
From NetSec
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
A variable is a storage location for something which holds a value which could be either known or unknown. It can be/is liable to change and is not persistent. We can set data to names and these are our variables. For example: | A variable is a storage location for something which holds a value which could be either known or unknown. It can be/is liable to change and is not persistent. We can set data to names and these are our variables. For example: | ||
− | < | + | <syntaxhighlight lang="php"> |
+ | $Name = "This is a string"; | ||
+ | </syntaxhighlight> | ||
In programming, there are many different ways to do this in a lot of different languages. Some have limits to how much data the variable can store and others are unlimited. | In programming, there are many different ways to do this in a lot of different languages. Some have limits to how much data the variable can store and others are unlimited. | ||
The variable will hold the data assigned to it until a new value is assigned or the program holding it is finished. | The variable will hold the data assigned to it until a new value is assigned or the program holding it is finished. |
Latest revision as of 00:22, 30 September 2012
Something that contains data, for example, if you declare a variable "int x = 1", the variable x will contain the integer value of 1.
A variable is a storage location for something which holds a value which could be either known or unknown. It can be/is liable to change and is not persistent. We can set data to names and these are our variables. For example:
<syntaxhighlight lang="php"> $Name = "This is a string"; </syntaxhighlight>
In programming, there are many different ways to do this in a lot of different languages. Some have limits to how much data the variable can store and others are unlimited. The variable will hold the data assigned to it until a new value is assigned or the program holding it is finished.