[fpc-pascal] Variable arguments, different types?

L505 fpc505 at z505.com
Thu Mar 9 05:31:14 CET 2006


> >
> > In other words you can reinvent your own writeln style procedures and pass
> > parameters of *different types* simutaneously. I was under the impression
you
> > could only pass parameters of the same type through this [] square bracket
> > trickery.
> >
>
> See docs: [http://www.freepascal.org/docs-html/ref/refsu47.html]
>


I already RTFM actually :-)

My point was that the docs do not state that you can send multiple types within
one shot.

  test([1, 1.456, 'test', -64, 'some string]);

I have also read people stating things like this before:

"you can use array of const but you can't make functions like writeln because
writeln accepts multiple types".

But in fact, with array of const, you can use multiple types.

Note the difference between:

  test(['string1', 'string2', 'string3]);  // all the same types

And:

  test([1, 1.456, 'test', -64, 'some string]); // different types





More information about the fpc-pascal mailing list