what is the “less than followed by dash” operator in go language?

后端 未结 3 472
臣服心动
臣服心动 2021-02-03 21:45

What is the <- operator in go language? Have seen this in many code snippets related to Go but what is the meaning of it?

3条回答
  •  梦如初夏
    2021-02-03 21:54

    Receive operator

    For an operand ch of channel type, the value of the receive operation <-ch is the value received from the channel ch.

    It receives a value from a channel. See http://golang.org/ref/spec#Receive_operator

提交回复
热议问题