Control Flow in Go
Go simplifies logic with a clean syntax.
If Statement:
Note: No parentheses required around conditions. go if age > 18 { fmt.Println("Adult") }
Switch:
Go switches don't need break (it breaks by default).
go
switch os := runtime.GOOS; os {
case "darwin":
fmt.Println("macOS")
default:
fmt.Println("Other")
}