In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
The basic syntax of go defines variables
There are two ways to define variables in the go language: var, as follows
Var a = 1
Assign the a variable to 1 in the second way ": =", as follows:
A: = 1
As above, assign a variable to 1`Note: variable name: = variable value, this method is only applicable to the first assignment of a variable, if the variable has been assigned, such as the an above has been assigned to 1, at this time, if you want to re-assign a value in the use of a: = 2, you can change the assignment directly a = 2
Define the function:
There is no class keyword or class concept in the go language. Go is mainly a function-oriented and interface-oriented programming language.
Define the keyword func of the function, as follows:
Syntax: the content in [] is optional
Func function name ([parameter name] [parameter type]) [function return value type] {function specific logic [return] [returned content]}
Loop:
In go, there are only for loops and no other loops.
The basic way of writing:
For I: = 0; I = 10; iTunes + {loop body content}
4There is nothing wrong with it. Judge
1.if judgment:
If condition {processing logic} else {processing logic} switch and case judgment
Syntax: switch [variable name] {case condition 1: processing logic case condition 2: processing logic default: processing logic} the above method is a bit similar to case in shell
5. Slice slice
Define slice:
Variable name: = [length] type, as follows: define a slice of int type with length 10
Arr: = [10] int
Define a variable length slice:
Var arr1 = [...] Int {} or: arr: = [...] int {0Pert 1je 2jue 3jre 4jre 5jr 6jr 7}
Map type:
B: = make (map [string] string) c: = make (map [string] int) above is the definition of two map, one is bmeme c make is to open up memory space, the map keyword, [] is the key type, string and int are both value types
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.