When compiling the go language;
Wrote a code like this.
Package Main
Import "FMT"
Func Main () {
Fmt. Println ("Hello, World")
}
When you run it, report such a mistake.
Syntax error:unexpected semicolon or newline befor {
Debugging a long time later found to be the reason for curly braces
The curly brackets of the Go language method cannot be placed below the method name like C #, and the curly braces at the beginning need to be placed in front of the method name
Package Main
Import "FMT"
Func Main () {
Fmt. Println ("Hello, World")
}
The operation results are as follows
The curly brackets of the Go language method cannot be placed below the method name like C #, and the curly braces at the beginning need to be placed in front of the method name
Original address: https://www.lesg.cn/mianfeijiaocheng/go/2016-444.html
Go Language Hello Summary