假设我有一个函数可以在每次刷新后不断向集合中添加一个随机数。
Myfunction
|list length data |
z := Set new.
x := 8.
data:= received data after each refresh.
length := data size.
1 to: length do:[:k | list := data at: k.
list < x
"How to check if this data already exist and not add"
ifTrue:[z add: list]
如果一个数字已经存在,我如何检查 Pharo,如果存在,它不应该再次添加它?