In Scala 3, the PartialFunction type and the case syntax have been refined to enhance expressiveness and clarity. A PartialFunction is essentially a function that is defined for a subset of its input type.
The body of the Function uses the case _ => (s, i) syntax, which acts as a total function in this context, since _ matches any value. This means the match is always successful.
Scala allows conversion to Unit as any value can be cast to Unit. The tuple (s, i) is discarded, fulfilling the output requirement of the PartialFunction.
Collection
[
|
...
]