if, switch, goto / if statement / Essential Go

Run Settings
LanguageGo
Language Version
Run Command
package main import "fmt" func returnValues(ok bool) (int, bool) { return 5, ok } func main() { if n, ok := returnValues(true); ok { fmt.Print("ok is true, n: %d\n", n) } else { fmt.Print("ok is false, n: %d\n", n) } // n is only visible within if statement, so this fails compilation fmt.Printf("n: %d\n", n) }
Editor Settings
Theme
Key bindings
Full width
Lines