Basic Syntax and Conventions

Go syntax is simple and clean. Key points:

  • Semicolons are not required
  • Use := for short variable declarations
  • Function names starting with capital letters are exported
  • Packages are imported using import "package"
var x int = 10
name := "GoLang"

func greet(name string) string {
    return "Hello, " + name
}
← PrevNext →