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, )
for i := range pow {
pow[i] = i << uint(i)
}
for _, value := range pow {
fmt.Printf("%d\n", value)
}
}

A Tour of Go Range continued的更多相关文章

  1. A Tour of Go Range

    The range form of the for loop iterates over a slice or map. package main import "fmt" , , ...

  2. A Tour of Go Methods continued

    In fact, you can define a method on any type you define in your package, not just structs. You canno ...

  3. A Tour of Go For continued

    As in C or Java, you can leave the pre and post statements empty. package main import "fmt" ...

  4. A Tour of Go Map literals continued

    If the top-level type is just a type name, you can omit it from the elements of the literal. package ...

  5. exercise.tour.go google的go官方教程答案

    /* Exercise: Loops and Functions #43 */ package main import ( "fmt" "math" ) fun ...

  6. Range Minimum Query and Lowest Common Ancestor

    作者:danielp 出处:http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAnc ...

  7. go官网教程A Tour of Go

    http://tour.golang.org/#1 中文版:http://go-tour-cn.appsp0t.com/#4 package main import ( "fmt" ...

  8. Codeforces 490F. Treeland Tour 暴力+LIS

    枚举根+dfs 它可以活 , 我不知道有什么解决的办法是积极的 ...... F. Treeland Tour time limit per test 5 seconds memory limit p ...

  9. 【读书笔记】A Swift Tour

    素材:A Swift Tour 推荐下载Playground:Download Playground objc 自己较为熟悉,想熟悉下风头正劲的 swift.就先从官方的入门手册开始撸. 每一小节,我 ...

随机推荐

  1. [模拟]ZOJ3480 Duck Typing

    题意:给了一坨...按题目意思输出就好了... 给一组案例 begin class d class c:d class b:c class a:b def d.m def d.n call a.m e ...

  2. Android:反编译查看源码

    下载>>>>>>>>>>>>>>> 使用图形化反编译工具:Androidfby 打开Androidfby中的A ...

  3. Nginx+uWSGI或fastcgi部署Django项目

    nginx+uWSGI ubuntu下先安装下C编译器和Python环境: sudo apt-get install build-essential python-dev 使用pip安装uWSGI: ...

  4. 安装Hadoop系列 — eclipse plugin插件编译安装配置

    [一].环境参数 eclipse-java-kepler-SR2-linux-gtk-x86_64.tar.gz //现在改为eclipse-jee-kepler-SR2-linux-gtk-x86_ ...

  5. C/C++中static关键词的作用

    1.在函数体内的static变量作用范围是该函数体,其只被内存分配一次,所以在下次调用的时候会保持上一次的值. 2.模块内的static全局变量可以被模块内的所有函数访问,但不能被模块外的函数访问. ...

  6. 转 Android adb root权限

    永久root带文件 因为开发需要,我经常会用到adb这个工具(Android Debug Bridge),我们都知道adb shell默认是没有root权限的,修改系统文件就很不方便了,adb pus ...

  7. 大四实习准备3_java多线程

    4.25.27无耻地懒散了.....26号陪女朋友去了.今天28号,继续加油! 2015-4-28 Java 多线程 (java中类不能多继承,可以多层继承:接口则都可以) 定义和创建: 方法一:继承 ...

  8. CQOIX2007余数之和

    朴素能得个差不多吧…… 这题改进算法真恶心 pascal一直过不了,难道非得转c++? 代码:(pascal) var n,k,i,l,r,m:longint; ans:qword; function ...

  9. Linux 根文件系统制作

    1.创建根文件目录 mkdir rootfs(名字是随便取的) 2.创建子目录 cd rootfs mkdir bin dev etc lib proc sbin sys usr mnt tmp va ...

  10. android 组件设置屏幕大小

    WindowManager wManager = getWindowManager(); DisplayMetrics metrics = new DisplayMetrics(); wManager ...