operators - ":="有什么作用?

标签 operators colon-equals

我在多个代码示例中看到过 := 使用,但从未附带过解释。如果不知道它的正确名称,就不可能通过谷歌搜索它的用途。

它有什么作用?

最佳答案

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.

注意:我通过搜索冒号等于运算符找到了这个

关于operators - ":="有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5344694/

相关文章:

c++ - 如何重载 << 运算符?

go - var vs := in Go

c++ - 与 'operator=' 不匹配

javascript - 了解递增

r - 冒号等于 R 中的运算符?新语法?

embedded - <= 和 := in VHDL 之间有什么区别

operators - := operator do in Elm? 到底是做什么的

delphi对象分配与:=

javascript - javascript和lua计算结果不同

c - 带逻辑运算符的有符号和无符号整数