Braces define scope
Unlike Python, Go blocks are defined by {}:
if x > 0 {
fmt.Println("positive")
}
The opening brace must be on the same line as the condition. The closing brace sits alone. This is a Go style rule enforced by gofmt.
Switch statements
switch is a cleaner alternative to long if/else chains:
switch op {
case "+":
return a + b
case "-":
return a - b
default:
return 0
}
Each case compares with ==. Values are compared in order; the first match wins and the switch ends automatically.