[fpc-pascal]How to get the values stored in a set

Anton Tichawa anton.tichawa at chello.at
Tue Dec 3 05:36:40 CET 2002


On Tuesday 03 December 2002 01:33, Karl Brandt wrote:

hi, karl!

you can test for an element, e. g. 12, with:

if 12 in Test then ..

to count the elements, you can write somthing like

var
  I: Integer;
  N: Integer;
begin
  N := 0;
  for I := 1 to 50 do begin
    if I in Test then Inc(N);
  end;

hth,

anton.

> I'd like to know how to get the values of a set.
> For example:
> Type TSet = set of 1..50;
> Var Test:TSet;
>
> begin
>      Test:=[12 ,25,15]; //set with some alleatory values
>      ?? //How can i know that this set has 3 itens and the itens are 12,
> 25 and 15?
> end;
>
> Any help is welcome;
> Thanks in advance;
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list