Type Inference
Scala can often infer types, reducing boilerplate code.
Examples
val x = 42 // Inferred as Int
val name = "Alice" // Inferred as String
val list = List(1, 2, 3) // Inferred as List[Int]
However, you can still annotate types explicitly when needed:
val name: String = "Bob"
Type inference works well with functions too:
val add = (x: Int, y: Int) => x + y