Question
What does yield do in a Scala for-comprehension?
Select an option. Your answer will be checked instantly.
Correct Answer: D. Collects the produced values into a result collection
Explanation:
Without yield, a for-comprehension is commonly used for side effects.
With yield, it transforms input elements into a new collection.
Leave a Reply