Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- a := []string{"Ivan", "Oleg", "Dennis"}
- fmt.Println(join(",", a...))
- }
- func join(sep string, l ...string) (res string) {
- for i, x := range l {
- res = res + x
- if i < len(l)-1 {
- res = res + sep
- }
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment