diff --git a/README.md b/README.md index 7e293c7..20ba33d 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,17 @@ var foo, bar int = 42, 1302 // declare and init multiple vars at once var foo = 42 // type omitted, will be inferred foo := 42 // shorthand, only in func bodies, omit var keyword, type is always implicit const constant = "This is a constant" + +// iota can be used for incrementing numbers, starting from 0 +const ( + _ = iota + a + b + c = 1 << iota + d +) + fmt.Println(a, b) // 1 2 (0 is skipped) + fmt.Println(c, d) // 8 16 (2^3, 2^4) ``` ## Functions