Variadic function: Difference between revisions

no edit summary
m (→‎Delphi: fix edit 050377 by MaiconSoft: substitute external link to internal target by proper MediaWiki syntax)
No edit summary
Line 1,260:
 
In '''[https://formulae.org/?example=Variadic_function this]''' page you can see the program(s) related to this task and their results.
 
=={{header|FutureBasic}}==
<lang futurebasic>void local fn Function1( count as long, ... )
va_list ap
long value
 
va_start( ap, count )
while ( count )
value = fn va_argLong( ap )
printf @"%ld",value
count--
wend
 
va_end( ap )
end fn
 
void local fn Function2( obj as CFTypeRef, ... )
va_list ap
 
va_start( ap, obj )
while ( obj )
printf @"%@",obj
obj = fn va_argObj(ap)
wend
 
va_end( ap )
end fn
 
window 1
 
// params: num of args, 1st arg, 2nd arg, etc.
fn Function1( 3, 987, 654, 321 )
 
print
 
// params: 1st arg, 2nd arg, ..., NULL
fn Function2( @"One", @"Two", @"Three", @"O'Leary", NULL )
 
HandleEvents</lang>
{{Out}}
<pre>987
654
321
 
One
Two
Three
O'Leary</pre>
 
=={{header|Go}}==
408

edits