2018-11-13 17:43:25 +03:00
|
|
|
// 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() {
|
2018-12-18 15:20:37 +03:00
|
|
|
evens := []int{2, 4}
|
|
|
|
|
odds := []int{3, 5, 7}
|
2018-11-13 17:43:25 +03:00
|
|
|
|
2018-12-18 15:20:37 +03:00
|
|
|
s.Show("evens [before]", evens)
|
|
|
|
|
s.Show("odds [before]", odds)
|
2018-11-13 17:43:25 +03:00
|
|
|
|
2018-12-18 15:20:37 +03:00
|
|
|
N := copy(evens, odds)
|
|
|
|
|
fmt.Printf("%d element(s) are copied.\n", N)
|
2018-11-13 17:43:25 +03:00
|
|
|
|
2018-12-18 15:20:37 +03:00
|
|
|
s.Show("evens [after]", evens)
|
|
|
|
|
s.Show("odds [after]", odds)
|
2018-11-13 17:43:25 +03:00
|
|
|
}
|