book icon indicating copy to clipboard operation
book copied to clipboard

Ch3.3 - Function with variable number of args - not mentioned.

Open stephan57160 opened this issue 3 years ago • 0 comments

  • [x] I have checked the latest main branch to see if this has already been fixed
  • [x] I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem: https://doc.rust-lang.org/book/ch03-03-how-functions-work.html#parameters

Description of the problem: Most of the languages support variable number of args (use of ... in C). I don't see anywhere if variable number of argument is supported or not, in this chapter. I guess it's not supported, but it comes clear only in Chapter 19-6, when we talk about macros:

A function signature must declare the number and type of parameters the function has. Macros, on the other hand, can take a variable number of parameters: we can call println!("hello") with one argument or println!("hello {}", name) with two arguments. 

I think it's a bit late, and could be more explicit in the chapter related to functions itself.

Suggested fix: Bring this info in Chapter 3.3.

stephan57160 avatar Apr 04 '22 20:04 stephan57160