The difference between '=' and ':=' in golang

王林
Release: 2019-12-06 16:11:58
Original
4415 people have browsed it

The difference between '=' and ':=' in golang

In golang, "=" means assignment, and ":=" means declaring variables and assigning values.

For example:

// = 使用必须使用先var声明例如:
var a
a=100
//或
var b = 100
//或
var c int = 100
Copy after login

For example:

// := 是声明并赋值,并且系统自动推断类型,不需要var关键字
d := 100
Copy after login

Recommended related articles and tutorials: golang tutorial

The above is the detailed content of The difference between '=' and ':=' in golang. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!