Scala: How to use break and continue in for and while loops
alvin
June 7, 2015 - 3:22pm
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 3.5, “ Scala: How to use break and continue in for loops (and while loops)”
Problem
You have a situation where you need to use a break
or continue
construct, but Scala doesn’t have break
or continue
keywords.