add: slices advanced ops

This commit is contained in:
Inanc Gumus
2019-02-28 13:25:12 +03:00
parent 33add371bd
commit 330abbce5a
11 changed files with 4 additions and 3 deletions

View File

@@ -0,0 +1,28 @@
// 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 (
"fmt"
s "github.com/inancgumus/prettyslice"
)
func main() {
evens := []int{2, 4}
odds := []int{3, 5, 7}
s.Show("evens [before]", evens)
s.Show("odds [before]", odds)
N := copy(evens, odds)
fmt.Printf("%d element(s) are copied.\n", N)
s.Show("evens [after]", evens)
s.Show("odds [after]", odds)
}