In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.