Go 슬라이스 비우기

1 개요[ | ]

Go 슬라이스 비우기
package main

import "fmt"

func main() {
	nums := []int{10, 20, 30, 40, 50}
	fmt.Println(nums) // [10 20 30 40 50]
	nums = nums[:0]   // Empty the slice
	fmt.Println(nums) // []
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}