program InsertElementInSet;
type
TMySet = set of 1..10; // Define a set with elements from 1 to 10
var
MySet: TMySet;
i : Integer;
begin
MySet := []; // Initialize the set as empty
Include(MySet, 1); // Insert the element 1 into the set
Include(MySet, 5); // Insert the element 5 into the set
Include(MySet, 6); // Insert the element 6 into the set
// Display the result
if 5 in MySet then
WriteLn('Element 5 has been successfully added to the set!');
for i := Low(TMySet) to High(TMySet) do
if i in MySet then
WriteLn('Set contains: ', i);
end.
(*
run:
Element 5 has been successfully added to the set!
Set contains: 1
Set contains: 5
Set contains: 6
*)