Skip to content
Justice Tech School

Sets

Sets hold unique values. union, intersection and difference combine them.

Example
var a = {1, 2, 3};
var b = {3, 4};
print(a.union(b));
print(a.intersection(b));
print(a.difference(b));
print(a.add(2));

Exercise

Common items.

a.(b)

Quiz Test

Do sets keep duplicates?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.