Variadic function
Variadic function
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Create a function which takes in a variable number of arguments and prints each one on its own line.
Java
Using ... after the type of argument will take in any number of arguments and put them all in one array of the given type with the given name. <java>public static void printAll(Object... things){
for(Object i:things){ System.out.println(i); }
}</java> This function can be called with any number of arguments: <java>printAll(4, 3, 5, 6, 4, 3); printAll(4, 3, 5); printAll("Rosetta", "Code", "Is", "Awseome!");</java>