Open main menu

Template:Computer Programming/Variables/1

Variables are references that stand in for a value that is contained at a certain memory address.

Variables are said to have a value and may have a data type. If a variable has a type, then only values of this type may be assigned to it. Variables do not always have a type.

A value can have many values of many different types: integers (7), ratios (1/2), (approximations of) reals (10.234), complex numbers (4+2i), characters ('a'), strings ("hello"), and much more.

Different languages use different names for their types and may not include any of the above.

Assignment statementsEdit

An assignment statement is used to set a variable to a new value.