From now on, I would like to summarize what I did as a memorandum when learning the GO language. There are quite a few things I want to try using the GO language, so I'm studying from scratch. (Isn't cryptanalysis really cool?) I think it will be slow to update because it will be a study that takes place between studies, but I would like to do it little by little. I would appreciate it if you could let me know if you made a mistake.
Let's do it!
・ Notebook PC ・ Windows 10 ・ Visual Studio Code ・ GO ver.1.15.2
I'm using
The contents of the program look like this
hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
//Execution method
>go run hello.go
//Hello World!Is output, OK
The concept of modules and the definition of functions are similar to how to write in other languages. It feels like they are united.
package: Magic. Instead, GO seems to have to belong to some package in every program, that declaration. In this program, it belongs to the package "main", and the main function belonging to the main package is executed immediately after the program runs.
import: Used when using the one included in another package. "Fmt" seems to be a print package, which allows you to use Print () and Printf (). The import declaration comes after the package declaration
func: Here is the definition of the main function
that's all.
Recommended Posts