kotlin string list

// Step 1: Create an empty mutable list of strings
val stringList = mutableListOf<String>()

// Step 2: Add strings to the list using the add() function
stringList.add("First String")
stringList.add("Second String")
stringList.add("Third String")

// Step 3: Access elements in the list by index
val firstElement = stringList[0]
val secondElement = stringList[1]

// Step 4: Print the elements of the list
println("Elements in the list:")
stringList.forEach { println(it) }

// Step 5: Check if the list contains a specific string
val containsString = stringList.contains("Second String")

// Step 6: Remove an element from the list
stringList.remove("Third String")

// Step 7: Check if the list is empty
val isEmptyList = stringList.isEmpty()

// Step 8: Clear all elements from the list
stringList.clear()