do sets loose their order

hi

do sets loose or retain their order

will the order of the set be the order that items are added to the set or not?

thanks

There’s nothing to lose as they have no guaranteed order. If you add 1,2,3,4, that’s what you have, sure. But if you keep manipulating it, remove, re-add elements, there will be no order.

thanks

i need to maintain order so i switch back from set to array although set is slightly easier to use