Assignment statements are expressions used in computer programming that allow a programming language to assign a value to a variable. Assignment statements are considered a basic component of data handling and are found in a variety of languages, such as Perl, Python and .NET. While their use is similar across all languages the exact notation a languages uses to display an assignment statement can vary.
In his guide to undergraduate computer science students, Michigan Tech professor Ching-Kuang Sheng explains that all assignment statements have the form "variable = expression." The variable on the left-hand side represents a symbol that will assume the value of the expression on the left. The "=" sign in the middle is called an assignment operator, and usually takes two forms: "=" or ":=". While the syntax is different, they both serve the same purpose of assigning an expression value to a variable.
Programmers commonly use assignment statements to assign integer value to variables. For example, the term "x=1" is an assignment statement. After creating this assignment statement, anytime the variable x is used later in the same program, the computer will evaluate it as if the symbol had a value 1. Assignment statements can also be used to evaluate more complex mathematical expressions. For example, if you created the assignment value x=1 and a second assignment statement y = x +1, the second assignment statement would evaluate to 2.
Numbers and mathematical expressions aren't the only types of data you can put into an assignment statement. For example, in its guide to assignment statements, Microsoft gives the example of the assignment statement a="string variable assignment". In this instance, the term on the right-hand side of the statement is just a string of text, and if you were to have your computer evaluate the variable a it would print out "string variable assignment" and not a numeric value.
Some languages use assignment statements in slightly different ways. For example, in his book "Perl Programming Language" computer scientist Larry Wall describes how you can use the assignment statement "a,b=0,1" to simultaneously assign expressions to two different variables in the Perl computer language. Similarly, the New Mexico Technical University department of Computer Science explains how you can assign more than one expression to a variable with the Python programming language. For example, you could create the following expression with Python "L = [male, tall, 23]," where the values inside the brackets are different expressions that can all be associated with the variable L, depending on what other parameters you program around the assignment statement.