Golang算子之间的区别:= vs = [英] Golang operator difference between := vs =

查看:74
本文介绍了Golang算子之间的区别:= vs =的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

中, = := 运算符之间有什么区别?他们似乎都是为了分配?这可能是显而易见的,但我似乎无法在文档中找到它。

是赋值运算符。

:= 其实不是运营商。它是短变量声明子句的语法的一部分。


In Go, what is the difference between the = and := operator? They both seem to be for assignment? This might be obvious but I can't seem to find it in the docs.

解决方案

Only = is the assignment operator.

:= is actually not an operator at all. It is a part of the syntax of the Short variable declarations clause.

这篇关于Golang算子之间的区别:= vs =的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆