Literal

Line and block comments

Line comments extend to end of line; block comments end at the first closing delimiter and cannot nest. A block comment without a newline acts as a space; other comments act as a newline. Example output: '3'.

Formal Syntax & Structure

go syntaxgo
// text/* text */

Working Example

Example Snippetgo
package main
import "fmt"
func main() {  fmt.Println(1 /* units */ + 2) // total}
Go Reference