Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
daebf91d
Commit
daebf91d
authored
Jun 16, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix up grammar for optional elements in if and switch conditions
SVN=122915
parent
39b28df0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
go_lang.txt
doc/go_lang.txt
+4
-5
No files found.
doc/go_lang.txt
View file @
daebf91d
...
...
@@ -1582,10 +1582,10 @@ If statements
If statements have the traditional form except that the
condition need not be parenthesized and the "then" statement
must be in brace brackets. The condition may be omitted in which
must be in brace brackets. The condition may be omitted
,
in which
case it is assumed to have the value "true".
IfStat = "if" [ [ Simple
Stat ";" ] Express
ion ] Block [ "else" Statement ] .
IfStat = "if" [ [ Simple
stat ] ";" ] [ Condit
ion ] Block [ "else" Statement ] .
if x > 0 {
return true;
...
...
@@ -1593,8 +1593,7 @@ case it is assumed to have the value "true".
An "if" statement may include the declaration of a single temporary variable.
The scope of the declared variable extends to the end of the if statement, and
the variable is initialized once before the statement is entered. If a variable
is declared, the condition cannot be omitted.
the variable is initialized once before the statement is entered.
if x := f(); x < y {
return x;
...
...
@@ -1610,7 +1609,7 @@ Switch statements
Switches provide multi-way execution.
SwitchStat = "switch" [ [ Simple
Stat ";" ]
Expression ] "{" { CaseClause } "}" .
SwitchStat = "switch" [ [ Simple
stat ] ";" ] [
Expression ] "{" { CaseClause } "}" .
CaseClause = CaseList StatementList [ ";" ] [ "fallthrough" [ ";" ] ] .
CaseList = Case { Case } .
Case = ( "case" ExpressionList | "default" ) ":" .
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment