Assignment Operator

An assignment operator is any operator that assigns a value to a variable. This is almost always the equals sign ( = ). Assigning a value means to give a variable a value.

In this example, the variable score is given (assigned) a value of 100.

Example

'FreeBASIC Example
dim score as integer
score = 100
sleep
end
//Game Maker Example
score = 100;

In most programming languages, it is true that the assignment operator is simply the equals sign. In Pascal dialects, it is ( := ).

(* Pascal/Delphi Example *)
score := 100;

Have the game use the player's name

it is possible to have the game ask the player's name on startup and then display this name throughout the game at various times. This is good for getting a character name.

'FreeBASIC Example
DIM AS String playername
Input "What if your name"; playername

Related Pages

Categories: Math : Programming : Operators
page_revision: 5, last_edited: 1237811536|%e %b %Y, %H:%M %Z (%O ago)