Files
the-way-to-go_ZH_CN/eBook/exercises/chapter_5/multiple_for.go
2017-02-11 12:22:18 +08:00

19 lines
396 B
Go
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// multiple_for.go
package main
import "fmt"
func main() {
//multiple initialization; a consolidated bool expression with && and ||; multiple incrementation
for i, j, s := 0, 5, "a"; i < 3 && j < 100 && s != "aaaaa"; i, j, s = i+1,
j+1, s+"a" {
fmt.Println("Value of i, j, s:", i, j, s)
}
}
/* Output:
Value of i, j, s: 0 5 a
Value of i, j, s: 1 6 aa
Value of i, j, s: 2 7 aaa
*/