Contents

Hello World

一切都要从 《The C Programming Language》 中的 “Hello World” 说起

1
2
3
4
5
6
#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}

Go 泛型

示例

Go: The Next Step for Generics

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// https://go2goplay.golang.org/p/DLyfY7AX_AZ
func Print(type T)(s []T) {
	for _, v := range s {
		fmt.Print(v)
	}
}

func main() {
	Print([]string{"Hello, ", "playground\n"})
	Print([]int{1, 3})
}