Semicolons
The formal syntax uses semicolons ";"
as terminators in
a number of productions. Go programs may omit most of these semicolons
using the following two rules:
-
When the input is broken into tokens, a semicolon is automatically inserted
into the token stream immediately after a line's final token if that token is
- an identifier
- an integer, floating-point, imaginary, rune, or string literal
- one of the keywords
break
, continue
, fallthrough
, or return
- one of the operators and punctuation
++
, --
, )
, ]
, or }
-
To allow complex statements to occupy a single line, a semicolon
may be omitted before a closing
")"
or "}"
.
To reflect idiomatic use, code examples in this document elide semicolons
using these rules.
If you want to change selection, open document below and click on "Move attachment"
The Go Programming Language Specification - The Go Programming Languageken. Also, a newline or end of file may trigger the insertion of a semicolon. While breaking the input into tokens, the next token is the longest sequence of characters that form a valid token. <span>Semicolons The formal syntax uses semicolons ";" as terminators in a number of productions. Go programs may omit most of these semicolons using the following two rules: When the input is broken into tokens, a semicolon is automatically inserted into the token stream immediately after a line's final token if that token is an identifier an integer, floating-point, imaginary, rune, or string literal one of the keywords break, continue, fallthrough, or return one of the operators and punctuation ++, --, ), ], or } To allow complex statements to occupy a single line, a semicolon may be omitted before a closing ")" or "}". To reflect idiomatic use, code examples in this document elide semicolons using these rules. Identifiers Identifiers name program entities such as variables and types. An identifier is a sequence of one or more letters and digits. The first character in an identifier must be a Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details