Go TutorialLesson 4Free preview
Go Syntax
This lesson is part of Go · All levels
Summary
This lesson discusses the basic rules of writing the Go syntax. Each Go file is preceded by a package declaration, continued import when necessary, and contains functions including func main() as the program entry point. Go requires the use of curly braces and adding semicolon automatically at the end of the line, so you don't have to write it manually.
Key points
- Each file go must be preceded by a statement package, generally a package play for the executable
- The main() function in the play package is the program entry point
- Curly braces {} are mandatory and must not be placed on separate lines
- Go add semicolon automatically at the end of the statement
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.