[fpc-pascal] newbie questions
Howard Page-Clark
hdpc at talktalk.net
Mon Apr 19 17:36:06 CEST 2010
On 19/4/10 3:50, 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
>
type
Tbyteset = set of byte;
> * How does one define the _value_ of a Set or Array?
> numbers := (1,2,3) // error
> numbers := [1,2,3] // error
var
byteset : Tbyteset;
begin
byteset := []; // empty set
byteset := [0, 3, 101]; // puts literal values into the set
Include(byteset, 27]; // or byteset := byteset + [27];
Exclude(byteset, 3); // or byteset := byteset - [3];
end;
Note that set types are limited to 256 elements of ordinal types
(integer, char or enumeration).
Howard
More information about the fpc-pascal
mailing list