首页 > 其他 > 详细

A Tour of Go For

时间:2014-10-27 00:07:27      阅读:409      评论:0      收藏:0      [点我收藏+]

Go has only one looping construct, the for loop.

The basic for loop looks as it does in C or Java, except that the ( ) are gone (they are not even optional) and the { } are required.

package main 

import "fmt"

func main() {
    sum := 0
    for i := 0; i < 10; i++ {
        sum += i
    }
    fmt.Println(sum)
}

 

A Tour of Go For

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

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