Variable

From Bennu Wiki
Revision as of 03:12, 1 March 2008 by Sandman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A variable is a container containing a value. This value can vary, hence the name variable, as opposed to a constant of which the value cannot be changed. A variable can be of any datatype and can contain a value according to its datatype. For example, an integer has whole numbers between -2^31 and +2^31-1 (e.g. 23) , a float has a floating point number (e.g. 2.674) and a string has a series of characters (e.g. "Hello World!").

There is a number of predefined variables, like local variables and global variables. These variables are predefined, which means they exist without the programmer making them. They can contain useful information or perform an action when changed.

A function or process can accept values when called. The value it's called with is called an argument and the variable or value inside the function or process is called a parameter.

See Also