Task

Create a function which takes in a variable number of arguments and prints each one on its own line.

Also show, if possible in your language, how to call the function on a list of arguments constructed at runtime.



Functions of this type are also known as Variadic Functions.



Related task

   Call a function


def print_arg(text t) =
for x = t:
  if unknown x: message "unknown value"
  elseif numeric x: message decimal x
  elseif string x: message x
  elseif path x: message "a path"
  elseif pair x: message decimal (xpart(x)) & ", " & decimal (ypart(x))
  elseif boolean x: if x: message "true!" else: message "false!" fi
  elseif pen x: message "a pen"
  elseif picture x: message "a picture"
  elseif transform x: message "a transform" fi; endfor enddef;
 
print_arg("hello", x, 12, fullcircle, currentpicture, down, identity, false, pencircle);
end