Initial commit
This commit is contained in:
26
15-slices/02-append/02-examples/main.go
Normal file
26
15-slices/02-append/02-examples/main.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
s "github.com/inancgumus/prettyslice"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var basket []string
|
||||
|
||||
basket = append(basket, "banana")
|
||||
basket = append(basket, "milk", "apple")
|
||||
|
||||
todo := []string{"tea", "coffee", "salt"}
|
||||
basket = append(basket, todo...)
|
||||
|
||||
_ = append(basket, "pepper")
|
||||
|
||||
s.Show("my basket", basket)
|
||||
}
|
Reference in New Issue
Block a user