Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_10/anonymous_struct.go
2015-03-03 12:25:25 -05:00

15 lines
228 B
Go
Executable File

package main
import "fmt"
type C struct {
x float32;
int;
string;
}
func main() {
c := C{3.14, 7, "hello"}
fmt.Println(c.x, c.int, c.string) // output: 3.14 7 hello
fmt.Println(c) // output: {3.14 7 hello}
}