Skip to content

Instantly share code, notes, and snippets.

@jjuliano
Last active December 16, 2019 11:07
Show Gist options
  • Save jjuliano/9a61c13a78936887fefe32719a97a6c5 to your computer and use it in GitHub Desktop.
Save jjuliano/9a61c13a78936887fefe32719a97a6c5 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func basket(fruits ...string) {
for _, fruit := range fruits {
fmt.Printf("%s is in the basket\n", fruit)
}
}
func main() {
fruits := []string{"Apple", "Mango", "Orange", "Banana"}
basket(fruits...)
}
/*
Apple is in the basket
Mango is in the basket
Orange is in the basket
Banana is in the basket
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment