dastan12
dastan12

Reputation: 25

How to get a specific element from the set - PlusCal

Given the set, for example, {1, 2, 4, 10, 6} how can I get the element 4 to a variable var. What I want is to get element "4" from the set to a variable var: var = 4 And remove the element 4 from the set: set = {1, 2, 10, 6}

Upvotes: 0

Views: 400

Answers (1)

Hovercouch
Hovercouch

Reputation: 2312

Based on the comments, it sounds like you want this:

with x \in set do
   var := x;
   set := set \ {x};
end with;

Upvotes: 1

Related Questions