# [] bar(1, 2, 3); # [3] bar(1, 2, 3, "hello"); # [3 "hello"] bar(1, 2, 3, [4, 5], [6]); # [3, [4, 5], [6]] Contextual slurpy These parameters are declared with a plus (+) sign and they apply the "single argument rule", which decides how to handle the slurpy argument based upon context. Simply put, if only a single argument is passed and that argument is iterable, that argument is used to fill the slurpy parameter array. In any other case, +@ works like **@ (i.e., unflattened slurpy). sub zaz($a, $b, +@args) { say @args.perl; } zaz(1, 2); # [] zaz(1, 2, 3); # [3] zaz(1, 2, 3, "hello"); # [3 "hello"] zaz(1, 2, [4, 5]); # [4, 5], single argument fills up array zaz(1, 2, 3, [4, 5]); # [3, [4, 5]], behaving as **@ zaz(1, 2, 3, [4, 5], [6]); # [3, [4, 5], [6]], behaving as **@ In Ruby Ruby does not care about types of variadic arguments. def foo(*args) print args end foo(1) # prints `[1]=> nil` foo(1, 2) # prints `[1, 2]=> nil` In Rust Rust does not support variadic arguments in functions. Instead, it uses macros. macro_rules! calculate { // The pattern for a single `eval` (eval $e:expr) => {{ { let val: usize = $e; // Force types to be integers println!("{} = {}", stringify!{$e}, val); } }}; // Decompose multiple `eval`s recursively (eval $e:expr, $(eval $es:expr),+) => {{ calculate! { eval $e } calculate! { $(eval $es),+ } }}; } fn main() { calculate! { // Look ma! Variadic `calculate!`! eval 1 + 2, eval 3 + 4, eval (2 * 3) + 1 } } Rust is able to interact with C's variadic system via a feature switch. As with other C interfaces, the system is considered to Rust. In Scala object Program { // Variadic methods store any additional arguments they receive in an array. // Consequentially, `printArgs` is actually a method with one parameter: a // variable-length array of `String`s. private def printArgs(strings: String*): Unit = { strings.foreach(println) } def main(args: Array[String]): Unit = { printArgs("hello"); // short for printArgs(["hello"]) printArgs("hello", "world"); // short for printArgs(["hello", "world"]) } } In Swift Swift cares about the type of variadic arguments, but the catch-all type is available. func greet(timeOfTheDay: String, names: String...) { // here, names is [String] print("Looks like we have \(names.count) people") for name in names { print("Hello