How to select a single argument from arguments of variadic function in Go

1 Answer

0 votes
package main
 
import "fmt"
 
func main() {
    variadicf("go", "php", "python", "c++", "c#")
}
 
func variadicf(s ...string) {
    fmt.Println(s[0])
    fmt.Println(s[1])
    fmt.Println(s[2])
    fmt.Println(s[3])
    fmt.Println(s[4])
}
 
 
 
/*
run:
 
go
php
python
c++
c#
 
*/

 



answered Aug 15, 2020 by avibootz

Related questions

1 answer 200 views
1 answer 215 views
215 views asked Nov 4, 2020 by avibootz
1 answer 193 views
...