Forum Discussion

FICO's avatar
FICO
Community Manager
6 years ago

Delete a set of integer

Hi,

First time using this forum.

I have a set declared as:

IDS: set of integer

The IDs are populated within a for loop. At the end of every loop, I would like to delete the contents of the set and repopulate it with a new data in the next loop. I tried delcell(IDS), but it returns an error as the function is defined for arrays.

I would appreciate if you could help me with this seemingly simple problem that I didn't manage to figure out.

Thanks,

Yonas

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    You can delete the contents of a set by assigning it the empty set:

    IDS:={}

    or alternatively you can use:

    reset(IDS)

    Note however that it is not possible to delete set contents or remove any elements from a set if this set is employed as an index set for an array.