Advertisement
cwchen

[Go] Anonymous struct demo

Sep 19th, 2017
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.15 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     p := struct {
  9.         x float64
  10.         y float64
  11.     }{x: 3.0, y: 4.0}
  12.  
  13.     fmt.Println(p.x)
  14.     fmt.Println(p.y)
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement