From b01f612a693b2b39064c0b5bd75a5d0280e4179e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 18 Nov 2016 10:49:29 -0800 Subject: [PATCH] spec: add subtitles to section on "for" statements This matches what we already do for switch statements and makes this large section more visibly organized. No other changes besides introducing the titles. Fixes #4486. Change-Id: I73f274e4fdd27c6cfeaed79090b4553e57a9c479 Reviewed-on: https://go-review.googlesource.com/33410 Reviewed-by: Rob Pike Reviewed-by: Matthew Dempsky --- doc/go_spec.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 1a60a9eac7..5872eefb03 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -4799,8 +4799,8 @@ The "fallthrough" statement is not permitted in a type switch.

For statements

-A "for" statement specifies repeated execution of a block. The iteration is -controlled by a condition, a "for" clause, or a "range" clause. +A "for" statement specifies repeated execution of a block. There are three forms: +The iteration may be controlled by a single condition, a "for" clause, or a "range" clause.

@@ -4808,6 +4808,8 @@ ForStmt = "for" [ Condition | ForClause | RangeClause ] Block .
 Condition = Expression .
 
+

For statements with single condition

+

In its simplest form, a "for" statement specifies the repeated execution of a block as long as a boolean condition evaluates to true. @@ -4822,6 +4824,8 @@ for a < b { } +

For statements with for clause

+

A "for" statement with a ForClause is also controlled by its condition, but additionally it may specify an init @@ -4860,6 +4864,8 @@ for cond { S() } is the same as for ; cond ; { S() } for { S() } is the same as for true { S() } +

For statements with range clause

+

A "for" statement with a "range" clause iterates through all entries of an array, slice, string or map, -- 2.50.0