In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what the basic grammar of the Go language is, and the editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
GO marker
Go programs can be composed of multiple tags, which can be keywords, identifiers, constants, strings, and symbols. For example, the following GO statement consists of six tags:
Fmt.Println ("Hello, World!")
The 6 tags are (one per line):
1: fmt 2:. 3: Println 4: (5: "Hello, World!" 6:)
Line delimiter
In a Go program, a line represents the end of a statement. Each statement does not need to end with a semicolon like other languages in the C family, because the work will be done automatically by the Go compiler.
If you plan to write multiple statements on the same line, they must be used; artificially distinguished, but in actual development we do not encourage this practice.
Fmt.Println ("Hello, World!")
Annotation
/ / single-line comments
/ *
Multiline comment
, /
Identifier
An identifier is actually a sequence of one or more letters (AbeliZ and axiz) numbers (0,9) and underscores _, but the first character must be a letter or underscore, not a number.
The following are valid identifiers:
Mahesh kumar abc move_name a_123
Myname50 _ temp j a23b9 retVal
Keyword
Breakdefaultfuncinterfaceselectcasedefergomapstructchanelsegotopackageswitchconstfallthroughifrangetypecontinueforimportreturnvar
In addition to the keywords described above, the Go language has 36 predefined identifiers:
Appendboolbytecapclosecomplexcomplex64complex128uint16copyfalsefloat32float64imagintint8int16uint32int32int64iotalenmakenewnilpanicuint64printprintlnrealrecoverstringtrueuintuint8uintptr
Programs generally consist of keywords, constants, variables, operators, types, and functions.
These separators may be used in the program: parentheses (), braces [], and curly braces {}.
These punctuation marks may be used in the program:.,.
This is the end of this article on "what are the basic grammars of Go language?". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.