diff --git a/kotlinstudy/collections/List.kt b/kotlinstudy/collections/List.kt new file mode 100644 index 0000000..de311e7 --- /dev/null +++ b/kotlinstudy/collections/List.kt @@ -0,0 +1,19 @@ +package kotlinstudy.collections + +fun main() { + val readOnlyShapes = listOf("triangle", "square", "circle") + println(readOnlyShapes) + + println("The 1st item in the list `readOnlyShapes` is: ${readOnlyShapes[0]}") + println("The last item in the list `readOnlyShapes` is: ${readOnlyShapes.last()}") + println("The list `readOnlyShapes` has ${readOnlyShapes.count()} items") + println("circle" in readOnlyShapes) + + val shapes: MutableList = mutableListOf("triangle", "square", "circle") + println(shapes) + shapes.add("pentagon") + println(shapes) + shapes.remove("circle") + println(shapes) + +} \ No newline at end of file