You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless you assign the value of constant is `iota`, the first value of constant in the group `const()` will be `0`. If following constants don't assign values explicitly, their values will be the same as the last one. If the value of last constant is `iota`, the values of following constants which are not assigned are `iota` also.
@@ -224,11 +224,11 @@ Unless you assign the value of constant is `iota`, the first value of constant i
224
224
Go has one keyword called `iota`, this keyword is to make `enum`, it begins with `0`, increased by `1`.
225
225
```Go
226
226
const(
227
-
x = iota// x == 0
228
-
y = iota// y == 1
229
-
z = iota// z == 2
230
-
w // If there is no expression after the constants name, it uses the last expression,
231
-
//so it's saying w = iota implicitly. Therefore w == 3, and y and z both can omit "= iota" as well.
227
+
x = iota// x == 0
228
+
y = iota// y == 1
229
+
z = iota// z == 2
230
+
w // If there is no expression after the constants name, it uses the last expression,
231
+
//so it's saying w = iota implicitly. Therefore w == 3, and y and z both can omit "= iota" as well.
232
232
)
233
233
234
234
const v = iota// once iota meets keyword `const`, it resets to `0`, so v = 0.
@@ -363,8 +363,8 @@ For instance, in the case of `aSlice` and `bSlice` above, if you change the valu
363
363
- The length of `slice`.
364
364
- Capacity, the length from start index to end index of `slice`.
0 commit comments