Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Variable"
From NetSec
Levi99Vmsb (Talk | contribs) (moving template to bottom) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Something that contains data, for example, if you declare a variable "int x = 1", the variable <b>x</b> will contain the <b>int</b>eger value of <b>1</b>. | Something that contains data, for example, if you declare a variable "int x = 1", the variable <b>x</b> will contain the <b>int</b>eger value of <b>1</b>. | ||
− | + | ||
+ | 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. |
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.