diff options
| author | B.G.Adrian <aditza8@gmail.com> | 2018-07-19 21:44:26 +0300 |
|---|---|---|
| committer | Andrew Bonventre <andybons@golang.org> | 2019-01-30 19:17:23 +0000 |
| commit | 0b2cf7c0845f35c40cf2d699f801671149e9e2cb (patch) | |
| tree | 8f1ea804fa78f3b48e61707057fec5a80ccbc769 | |
| parent | df79fa323b803b074d1d58bef988babd261b04bd (diff) | |
| download | golang-id-tour-0b2cf7c0845f35c40cf2d699f801671149e9e2cb.tar.xz | |
content: clarify semantics of range clause
Fixes golang/tour#560
Change-Id: I91255fe7ddb6df16268d6adc6afa2a502f1265f0
Reviewed-on: https://go-review.googlesource.com/c/125055
Reviewed-by: Andrew Bonventre <andybons@golang.org>
| -rw-r--r-- | content/moretypes.article | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/content/moretypes.article b/content/moretypes.article index 955214e..5fe9401 100644 --- a/content/moretypes.article +++ b/content/moretypes.article @@ -247,7 +247,12 @@ The first is the index, and the second is a copy of the element at that index. You can skip the index or value by assigning to `_`. -If you only want the index, drop the `,` `value` entirely. + for i, _ := range pow + for _, value := range pow + +If you only want the index, you can omit the second variable. + + for i := range pow .play moretypes/range-continued.go |
