From cec0954dd04b585b1cadacbb5f46ae5ab76a371c Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Tue, 17 Sep 2013 07:41:11 +1000 Subject: [PATCH] spec: add example for continue to label Make the break example slightly more interesting Update #5725 Effective Go will be updated in a separate CL. R=golang-dev, iant CC=golang-dev https://golang.org/cl/13368054 --- doc/go_spec.html | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index b9249e1c78..7b74e8ffb5 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -3345,7 +3345,7 @@ As an exception to the addressability requirement, x may also be a (possibly parenthesized) composite literal. If the evaluation of x would cause a run-time panic, -then the evaluation of &x does too. +then the evaluation of &x does too.

@@ -3365,7 +3365,7 @@ will cause a run-time panic. var x *int = nil *x // causes a run-time panic -&*x // causes a run-time panic +&*x // causes a run-time panic @@ -4997,11 +4997,17 @@ and that is the one whose execution terminates.

-L:
-	for i < n {
-		switch i {
-		case 5:
-			break L
+OuterLoop:
+	for i = 0; i < n; i++ {
+		for j = 0; j < m; j++ {
+			switch a[i][j] {
+			case nil:
+				state = Error
+				break OuterLoop
+			case item:
+				state = Found
+				break OuterLoop
+			}
 		}
 	}
 
@@ -5023,6 +5029,18 @@ If there is a label, it must be that of an enclosing advances.

+
+RowLoop:
+	for y, row := range rows {
+		for x, data := range row {
+			if data == endOfRow {
+				continue RowLoop
+			}
+			row[x] = data + bias(x, y)
+		}
+	}
+
+

Goto statements

-- 2.48.1