GO 基础

基本语法练习 打印 乘法表

package main

import ("fmt")

func main(){
for n:=1;n<=9;n++{
for m:=1;m<=n;m++{
fmt.Print(m,"*",n,"=",m*n,"\t")
}
fmt.Println()
}
}

有意思的 裸返回 等价

package main

import "fmt"

func swap(x,y string)(b,a string){
a = x
b = y
return
} func main(){
var first = "hello"
var second = "world"
fmt.Println(swap(first,second))
} package main import "fmt" func swap(x,y string)(string,string){
return y,x
} func main(){
var first = "hello"
var second = "world"
first,second = swap(first,second)
fmt.Println(first,second)
}
上一篇:深入理解line-height


下一篇:JDBC学习入门