case 1
list.map(item => {
val newItem = process(item)
newItem
})
case 2
list.map{item => {
val newItem = process(item)
newItem
}}
In scala. you could use () or {} to wrap your parameter listing. When the function body is a case statement, using {} becomes much more understanding.
such as the following:
using {} with case statement
.flatMap {
case 1 => Sync[M].delay {
println(1);
}
case 2 => Sync[M].pure(2)
}
using () with case statement
.flatMap (
{
case 1 => Sync[M].delay {
println(1);
}
case 2 => Sync[M].pure(2)
}
)