Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
A set is a collection in Scala to store unordered unique items. For example, a set having strings "my" and "name" is defined as:
var myset:Set[String] = Set("my","name")
Now, let's declare a set of integers, named intSet
, having below elements.
To accomplish this, we will need to declare the set variable of type Set[Int]
as this set is going to have integers only.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...