[fpc-pascal] newbie questions

Marc Weustink marc at dommelstein.net
Tue Apr 20 01:17:51 CEST 2010


spir ☣ wrote:
> Hello,
> 
> Total Pascal newbie here. Looked for answers in various references and tutorials, but cannot find.
> 
> Fore-question: Is there a (free)pascal teaching/learning mailing list? (Like python's "tutor" list.) If not, is this one a proper place?
> 
> * How does one declare the type of set items?
>    numbers : Set of Integer	// error

A set can only have 256 elements, in you case that would have been 4G 
elements.
So the max is
   TByteSet = set of Byte;

but usually a set (or enum) is given a reable name like

   TMyEnum = (one, two, three);
   TMySet = set of TMyEnum;

> * How does one define the _value_ of a Set or Array?
>    numbers := (1,2,3)	// error
>    numbers := [1,2,3]	// error

const
   Numbers: array[0..3] of integer = (1, 2, 3, 4);
   MySet: TMySet = [one, three];


Somehow I get the idea that you mix the definition/use of sets with arrays.

Marc



More information about the fpc-pascal mailing list