Closed julibeg closed 1 month ago
It's not really semantically correct because you aren't returning a value for the else
branch. I think Groovy implicitly returns null but it's an edge case I wouldn't rely on. Instead I would do this:
workflow {
res = Channel.of(1, 2, 3)
res_squared = res | map { it * 2 }
res_squared_negative = res_squared | filter { it < 0 }
res.squared_negative
| ifEmpty("empty")
| view
}
Bug report
Expected behavior and actual behavior
When using an if-clause in
map
and not emitting anything, this just results in an empty channelI'd expect
multiMap
to behave the same, but the belowfails with
Environment