Answer Posted / Loma Patwa
In Scala, a 'guard' is a condition that can be used within a for-comprehension construct to filter the elements of an iterator or collection. The syntax for using a guard is: GuardedFor((expr) if (condition) yield result). It returns only those elements for which the condition evaluates to true.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers