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. Zookeeper + Hadoop + Hbase部署备忘

    网上类似的文章很多,本文只是记录下来备忘.本文分四大步骤: 准备工作.安装zookeeper.安装hadoop.安装hbase,下面分别详细介绍: 一 准备工作 1. 下载 zookeeper.had ...

  2. matlab 怎么保存plot的图 到指定文件夹

    %%使用print函数,第一个参数一定是figure的句柄,第二个参数设置格式,第三个参数是指定文件夹 %代码如下 h=figure; plot(1:10); print(h,'-djpeg','F: ...

  3. WCF的通信

    [ServiceContract]    public interface IContractDemoOne    {        [OperationContract(IsOneWay=true) ...

  4. javascript 小日历

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx. ...

  5. [ffmpeg 扩展第三方库编译系列] frei0r mingw32 下编译问题

    在编译安装frei0r的时候遇到两个错误地方, 两个都是在install的时候. 一开始编译都很顺利,输入了 make install之后就走开了,回来一看,报错误. 提示mkdir -p //usr ...

  6. Monitor vs WaitHandle

    http://stackoverflow.com/questions/1355398/monitor-vs-waithandle-based-thread-sync A problem with Mo ...

  7. 利用icepdf将pdf文件转为图片

    所需jar 包为icepdf-core.jar.icepdf-extra.jar.icepdf-pro-intl.jar.icepdf-pro.jar和icepdf-viewer.jar. 示例代码如 ...

  8. java的四舍五入算法

    粗力度的四舍五入为整数 package math; public class MathRoundTest { /** * Math类中提供了三个与取整有关的方法:ceil,floor,round, * ...

  9. 【转】如何在Ubuntu11.10(32位)下编译Android4.0源码(图文)

    原文网址:http://blog.csdn.net/flydream0/article/details/7046612 关于如何下载Android4.0的源码请参考我的另一篇文章: http://bl ...

  10. Erlang分布式在linux和windows上的注意事项

    没事做,就在两台机器间测试下Erlang分布式的例子,一个台是windowsXP,一台装的redHat9,没有详细的文档,自己摸索着搞成功了,记录下. 1.首先,分布式Erlang的实现提供了自有的安 ...