Go 슬라이스 처음 n개 남기고 제거

Jmnote (토론 | 기여)님의 2024년 3월 15일 (금) 10:17 판 (→‎같이 보기)

1 개요

Go 슬라이스 처음 n개 남기기
Go 슬라이스 처음 n개 원소 남기기
Go 슬라이스 처음 원소 n개 남기기
package main

import "fmt"

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

2 같이 보기

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