Search code examples
operatorscolon-equals

What does ":=" do?


I've seen := used in several code samples, but never with an accompanying explanation. It's not exactly possible to google its use without knowing the proper name for it.

What does it do?


Solution

  • http://en.wikipedia.org/wiki/Equals_sign#In_computer_programming

    In computer programming languages, the equals sign typically denotes either a boolean operator to test equality of values (e.g. as in Pascal or Eiffel), which is consistent with the symbol's usage in mathematics, or an assignment operator (e.g. as in C-like languages). Languages making the former choice often use a colon-equals (:=) or ≔ to denote their assignment operator. Languages making the latter choice often use a double equals sign (==) to denote their boolean equality operator.

    Note: I found this by searching for colon equals operator