Home > other >  Short variable
Short variable

Time:09-21

For the key, val:=range coll {
.
}

As above is how to explain the language, according to the brief statement of variable assignment, must contain a new variable declarations can through,
at the same levelHas been declared as an assignment,

CodePudding user response:

Similar to other languages, the for loop can define variables
Such as Java
for(int i=0; I<10; I++)//for the first expression is defined variable

For (String s: someStringSet)//, define a variable, followed by the set of variable type


CodePudding user response:

Look at the following code should understand the meaning of this sentence,
 
Func main () {
M: map [string] string={
"Hello" : "the world",
"A" : "a",
}

Var key, val string
For the key, val range m={
FMT. Println (key, val)
}

//for the key, val: range m={
//FMT. Println (key, val)
//}
}

  • Related