Go append()

Jmnote (토론 | 기여)님의 2023년 1월 19일 (목) 17:06 판 (새 문서: ==개요== ;Go append() <syntaxhighlight lang='go' run> package main import "fmt" func main() { var numbers []int numbers = append(numbers, 1, 3, 5) fmt.Println(numbers) // [1 3...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

Go append()
package main

import "fmt"

func main() {
	var numbers []int
	numbers = append(numbers, 1, 3, 5)
	fmt.Println(numbers) // [1 3 5]
}
package main

import "fmt"

func main() {
	var fruits = []string{"banana", "orange"}
	fruits = append(fruits, "apple", "mango")
	fmt.Println(fruits) // [banana orange apple mango]
}

2 같이 보기

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