SilapakornKrapankhie
11 views
10 slides
Feb 25, 2025
Slide 1 of 10
1
2
3
4
5
6
7
8
9
10
About This Presentation
golang
Size: 5.67 MB
Language: en
Added: Feb 25, 2025
Slides: 10 pages
Slide Content
Golang 101: Introduction to Go Programming An introductory journey into the world of Go, designed for beginners eager to explore this powerful language.
What is Go? Google's Creation Born at Google in 2009 Language Family Open-source, statically typed, compiled Designed For Simplicity, efficiency, and concurrency Used For Cloud, networking, system programming
Why Learn Go? 1 Clean Syntax Easy to read and learn 2 High Performance Compiled, garbage-collected 3 Concurrency Built-in goroutines 4 Ecosystem Strong community support
Setting Up Go Download From golang.org Set Up Env vars GOROOT, GOPATH Verify go version
Your First Go Program package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
} package main Entry point package import "fmt" Import standard library func main() {} Main function
Go Syntax Basics 1 Variables var name string = "Go" 2 Constants const version = 1.18 3 Short age := 30
Data Types Basic int, float64, string, bool Composite array, slice, map, struct Example arr := [3]int{1, 2, 3}
Control Structures If-Else if age > 18 {} 1 Loop for i := 0; i < 5; i++ {} 2
Functions 1 Simple Function func add(a int, b int) int {} 2 Multiple Return func swap(x, y string) (string, string) {}
Structs and Methods 1 Person Struct type Person struct {} 2 Greet Method func (p Person) Greet() {}