Expression

Evaluation order

Within functions, calls, channel receives and binary logical operations have lexical left-to-right ordering. Not every ordinary operand read is ordered relative to calls; avoid relying on unspecified side effects. Example output: '1\n2\n3'.

Formal Syntax & Structure

go syntaxgo
f() + g()

Working Example

Example Snippetgo
package main
import "fmt"
func mark(n int) int { fmt.Println(n); return n }func main() {  fmt.Println(mark(1) + mark(2))}
Go Reference