Collections in Scala

 Collections in Scala


Scala provides a rich set of collections, including lists, sets, maps, and more. Here's an example of a list:

go


val fruits = List("apple", "banana", "orange")

println(fruits(1)) // prints "banana"

And here's an example of a map:


rust


val prices = Map("apple" -> 0.99, "banana" -> 0.59, "orange" -> 0.79)

println(prices("banana")) // prints 0.59

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...