首页 > 其他 > 详细

A Tour of Go Range continued

时间:2014-10-27 06:52:37      阅读:243      评论:0      收藏:0      [点我收藏+]

You can skip the index or value by assigning to _.

If you only want the index, drop the ", value" entirely.

package main 

import "fmt"

func main() {
    pow := make([]int, 10)
    for i := range pow {
        pow[i] = i << uint(i)
    }
    for _, value := range pow {
        fmt.Printf("%d\n", value)
    }
}

 

A Tour of Go Range continued

原文:http://www.cnblogs.com/ghgyj/p/4053351.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!