'Go_tutorial' get started

Jon Lee 2024-05-12 18:23:55 +08:00
parent 94c4be1acf
commit 582624c28d

26
Go_tutorial.md Normal file

@ -0,0 +1,26 @@
# Go_tutorial
This is a tutorial to guide the learning for the programming language Go.
## Structure and Compilation
Let's first create a file called "Hello_JOJ.go", and write in:
```go
package main
import (
"fmt"
)
func main(){
fmt.Println("Hello "+ "JOJ")
}
```
Observe the structure it is similar to both Python and C++, as it needs to import certain library and need some special package to run the program. We will also see further that the syntax of Go is like the combination of both C++ and Python.
If you want to run the program, you can either choose to directly run it:
```bash
$ go run Hello_JOJ.go
```
or choose to compile it as a binary file:
```bash
$ go build Hello_JOJ.go
$ ./Hello_JOJ
```