"Go 슬라이스 마지막 n개 남기고 제거"의 두 판 사이의 차이

 
(차이 없음)

2024년 4월 28일 (일) 13:59 기준 최신판

1 개요[ | ]

Go 슬라이스 마지막 n개 남기고 제거
package main

import "fmt"

func main() {
	slice := []string{"A", "B", "C", "D", "E", "F", "G"}
	n := 3
	slice = slice[len(slice)-n:]
	fmt.Println(slice)
}

2 같이 보기[ | ]

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