Golang conditionals

From wikinotes
Revision as of 20:36, 23 May 2022 by Will (talk | contribs) (Created page with "= If statements = <blockquote> <syntaxhighlight lang="go"> if 1 > 0 { fmt.Println("true") } </syntaxhighlight> You can also assign and test a variable in one step. <synta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If statements

if 1 > 0 {
    fmt.Println("true")
}

You can also assign and test a variable in one step.

if err := file.Chmod(0664); err != nil {
    log.Print(err)
}