Variadic function: Difference between revisions

Content added Content deleted
imported>Arakov
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 3,183: Line 3,183:
=={{header|Wren}}==
=={{header|Wren}}==
Wren doesn't support variadic functions and doesn't really need to as we can just write a function which takes one (or one more) argument and pass it a list.
Wren doesn't support variadic functions and doesn't really need to as we can just write a function which takes one (or one more) argument and pass it a list.
<syntaxhighlight lang="ecmascript">var printArgs = Fn.new { |args| args.each { |arg| System.print(arg) } }
<syntaxhighlight lang="wren">var printArgs = Fn.new { |args| args.each { |arg| System.print(arg) } }


printArgs.call(["Mary", "had", "3", "little", "lambs"])</syntaxhighlight>
printArgs.call(["Mary", "had", "3", "little", "lambs"])</syntaxhighlight>