Passing arguments to ... parameters Language Specification


(Cherolyn Lexvold) #1
Passing arguments to ... parameters
If f is variadic with a final parameter p of type ...T,

What does it mean by “final” parameter?


(Norbert Melzer) #2

Final as in “last”.

A prominent function that is variadic (accepts a variable number of arguments) is fmt.Printf() which looks like this:

func Printf(format string, a ...interface{}) (n int, err error)

The ellipsis notation is only ever available for the last/final argument in the argumentlist.


(Cherolyn Lexvold) #3

What is an argumentlist? Self explanatory?

Another question…sorry, I forgot to put them together.

If f is invoked 

Are “invoked” and “called” synonymous?


(Cherolyn Lexvold) #4

In “func factorial(n int) int {
if n == 0 {
return 1
}
return n *”
What are the parameters?