30天30个Golang程序学习(一)(格式化输出)

第一天:


package main

import (
"fmt"
"time"
)

func main(){
day := time.Now().Weekday()
fmt.Printf("Hello,%s (%d)\n",day,day)
}

如果今天是周日,它将输出:

【30天30个Golang程序学习(一)(格式化输出)】Hello,Sunday (0)


以上程序在golang1.5.1 + ubuntu 15.10下调试通过。


个人微博:http://weibo.com/514860125

    推荐阅读