Notation
Common textual representations of the assignment include an equals sign (=) and colon-equals (:=). These two forms are typical of programming languages that classify assignment as an infix operator.
-
variable = expressionBASIC, Bourne shell, C (and many of its descendants), Fortran, Java, PL/I, Python, R, Windows PowerShell... variable := expressionALGOL, Simula, Algol68, Algol W, CPL, BCPL, Pascal, Mary, Modula, Ada, Smalltalk, Eiffel,, Modula-2, Modula-2+, Oberon, Modula-3, Dylan, Seed7, Io
Other possibilities include a left arrow or a keyword, though there are other, rarer, variants:
-
variable << expressionMagik variable <- expressionOCaml, R, S variable <<- expressionR variable ← expressionAPL variable =: expressionJ LET variable = expressionBASIC set variable to expressionAppleScript set variable = expressionC shell Set-Variable variable (expression)Windows PowerShell val variable = expressionML variable : expressionMacsyma, Maxima var variable expressionmIRC scripting language
Some platforms put the expression on the left and the variable on the right:
-
MOVE expression TO variableCOBOL expression → variableTI-BASIC, Casio BASIC expression -> variableR
Some expression-oriented languages, such as Lisp and Tcl, uniformly use prefix syntax for all statements, including assignment.
-
(setf variable expression)Common Lisp (set! variable expression)Scheme set variable expressionTcl
Read more about this topic: Assignment (computer Science)