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 = expression
BASIC, Bourne shell, C (and many of its descendants), Fortran, Java, PL/I, Python, R, Windows PowerShell... variable := expression
ALGOL, 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 << expression
Magik variable <- expression
OCaml, R, S variable <<- expression
R variable ← expression
APL variable =: expression
J LET variable = expression
BASIC set variable to expression
AppleScript set variable = expression
C shell Set-Variable variable (expression)
Windows PowerShell val variable = expression
ML variable : expression
Macsyma, Maxima var variable expression
mIRC scripting language
Some platforms put the expression on the left and the variable on the right:
-
MOVE expression TO variable
COBOL expression → variable
TI-BASIC, Casio BASIC expression -> variable
R
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 expression
Tcl
Read more about this topic: Assignment (computer Science)