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

Jmnote (토론 | 기여)님의 2024년 4월 28일 (일) 13:57 판 (→‎개요)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

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

import "fmt"

func main() {
	students := []string{"A", "B", "C", "D", "E"}
	n := 3
	students = students[:n]
	fmt.Println(students) // [A B C]
}

2 같이 보기

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