Go 슬라이스 마지막 n개 제거

1 개요[ | ]

Go 슬라이스 마지막 n개 제거
Go 슬라이스 마지막 n개 원소 제거
Go 슬라이스 마지막 원소 n개 제거
package main

import "fmt"

func main() {
	students := []string{"Alice", "Bob", "Carol", "David", "Eve"}
	n := 3
	students = students[:len(students)-n]
	fmt.Println(students) // [Alice Bob]
}

2 같이 보기[ | ]

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