Answer Posted / Akshita Mishra
In Scala, you can append data to a List using the :: (cons) operator or the ++ (append) operator. Here's an example:nn```scalanval list1 = List(1, 2, 3)nval newList = list1 :+ 4 // Using the cons operatorn// Ornval newList = list1 ++ List(4) // Using the append operator
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers