// Step 1: Import the necessary library for using sets
import kotlin.collections.setOf
fun main() {
// Step 2: Create a set using setOf function
val mySet = setOf("apple", "banana", "orange")
// Step 3: Access elements of the set using iteration
println("Elements of the set:")
for (element in mySet) {
println(element)
}
// Step 4: Check if a specific element is present in the set
val containsElement = mySet.contains("banana")
println("Does the set contain 'banana'? $containsElement")
// Step 5: Add an element to the set
val newSet = mySet + "grape"
// Step 6: Remove an element from the set
val updatedSet = newSet - "apple"
// Step 7: Print the updated set
println("Updated set after adding 'grape' and removing 'apple':")
for (element in updatedSet) {
println(element)
}
}