summary refs log tree commit diff stats
path: root/tests/sets/tsetpop.nim
blob: c37bda57d9fbfec669135c6407b4ce348f1ad3c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  targets: "c c++ js"
  output: '''1000
0
set is empty
'''
"""

import sets

var a = initSet[int]()
for i in 1..1000:
  a.incl(i)
echo len(a)
for i in 1..1000:  
  discard a.pop()
echo len(a)

try:
  echo a.pop()
except KeyError as e:
  echo e.msg