Besides the ability to apply function (like stringify `$`) to the parameters, 
varargs is nothing but an openArray with an alternative way of specifying 
arguments available. The normal way is still useful for e.g. when you forward 
parameters or when you don't know how many parameters you have and you pas over 
a seq:
    
    
    import strutils
    
    proc printStuff(x: varargs[string]) =
      for element in x:
        echo element
    
    let lines = readFile("file.txt").splitLines()
    
    # the same proc used in two occaisons
    # afaik in C++ you would have to write a wrapper for printStuff
    printStuff "Hi, how are you going?", "Here's the content of a file"
    printStuff lines
    
    
    Run

Reply via email to