Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
19
Task/Set/Nim/set.nim
Normal file
19
Task/Set/Nim/set.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
var # creation
|
||||
s = {0,3,5,10}
|
||||
t = {3..20, 50..55}
|
||||
|
||||
if 5 in s: echo "5 is in!" # element test
|
||||
|
||||
var
|
||||
c = s + t # union
|
||||
d = s * t # intersection
|
||||
e = s - t # difference
|
||||
|
||||
if s <= t: echo "s ⊆ t" # subset
|
||||
|
||||
if s <= t: echo "s ⊂ t" # strong subset
|
||||
|
||||
if s == t: echo "s = s" # equality
|
||||
|
||||
s.incl(4) # add 4 to set
|
||||
s.excl(5) # remove 5 from set
|
||||
Loading…
Add table
Add a link
Reference in a new issue