I am just starting to learn the language and I was asked in the report a question about ; where should I put it? surprisingly, there is very little information on the Internet about whether it needs to be installed or whether the compiler itself replaces it everywhere?
the semicolon is used to terminate statements, but its use is almost
entirely handled automatically by the compiler, that means that the compiler automatically
inserts semicolons at the end of statements.
The only typical scenario where you might manually use a semicolon is to write multiple
short statements on a single line, such as within a for loop’s initialization, condition,
and post-statement clauses as :
for i := 0; i < 10; i++ {
// …
}
– or –
if data, err := findValue(1); err != nil {
// handles error
}
1 Like
By the way i found this link No Semicolons Needed | Terts Diepraam