How can I create a function with a variable number of arguments?
In general, you can’t – Rust does not support variadic functions, except when interoperating with C code that uses varargs. In this case, since all of your arguments are the same type, you can accept a slice: fn foo(args: &[&str]) { for arg in args { println!(“{}”, arg); } } fn main() { foo(&[“hello”, “world”, … Read more