3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test for loops of many forms.
11 func assertequal(is, shouldbe int, msg string) {
13 print("assertion fail" + msg + "\n");
28 assertequal(i, 6, "break");
31 for i := 0; i <= 10; i++ {
34 assertequal(sum, 55, "all three");
37 for i := 0; i <= 10; {
41 assertequal(sum, 55, "only two");
47 assertequal(sum, 99 + 9, "only one");
50 for i := 0; i <= 10; i++ {
56 assertequal(sum, 1+3+5+7+9, "continue");