Skip to content

Instantly share code, notes, and snippets.

@178inaba
Last active July 18, 2020 21:54
Show Gist options
  • Save 178inaba/b6fa5c6d8daf9732669591f12fe0c653 to your computer and use it in GitHub Desktop.
Save 178inaba/b6fa5c6d8daf9732669591f12fe0c653 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
a := make([]int, 5001)
for i := 0; i < 5001; i++ {
a[i] = i
}
//fmt.Println(a[50000:])
for {
var x []int
if len(a) == 0 {
break
} else if len(a) < 500 {
x, a = a[:len(a)], a[len(a):]
} else {
x, a = a[:500], a[500:]
}
test(x)
}
fmt.Println("for end")
fmt.Println(a)
fmt.Println(len(a))
}
func test(x []int) {
fmt.Println(x)
fmt.Println(len(x))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment