Merge pull request #556 from KarthikNayak/patch-1

fix error in iota enumeration
This commit is contained in:
astaxie
2015-11-13 08:01:11 +08:00

View File

@@ -224,7 +224,7 @@ Go has one keyword called `iota`, this keyword is to make `enum`, it begins with
x = iota // x == 0
y = iota // y == 1
z = iota // z == 2
w // If there is no expression after the constants name, it uses the last expression, so it's saying w = iota implicitly. Therefore w == 3, and y and x both can omit "= iota" as well.
w // If there is no expression after the constants name, it uses the last expression, so it's saying w = iota implicitly. Therefore w == 3, and y and z both can omit "= iota" as well.
)
const v = iota // once iota meets keyword `const`, it resets to `0`, so v = 0.