loop on two variables
package main
import (
"fmt"
)
func main() {
for i, j := 1, 5; i+j < 20; i, j = i+1, j+2 {
fmt.Printf("%v %v\n", i, j)
}
}
1 5
2 7
3 9
4 11
5 13
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import (
"fmt"
)
func main() {
for i, j := 1, 5; i+j < 20; i, j = i+1, j+2 {
fmt.Printf("%v %v\n", i, j)
}
}
1 5
2 7
3 9
4 11
5 13