Add() MethodAdd() Method

You can also add elements to a set. To do this, there's a specific add() method. It's important to note that with this method, you can add only one element at a time. So, if you want to add 4 elements, for example, you'll need to use this method 4 times. Let's check out an example.


Here's your set:

Now, add these numbers to the set:
22, 24, 26, 28

Make sure to use the add() method.

Everything was clear?

Section 4. Chapter 2
toggle bottom row