Scala local return?
I've just discovered that return s in following closure will return from function findPackage def findPackage(name: String, suffix: Option[String] = None): Path = { logger.debug("Looking for package {} with suffix {}", name, suffix) val path: Path = using(Files.newDirectoryStream(appDir)) {dirs => for (val path <- dirs) { val matcher = packagePattern.matcher(path.getFileName.toString) if (matcher.matches() && matcher.group(1).equals(name)) if (suffix.isDefined) { if (matcher.group(2) != null && matcher.group(2).equals(suffix.get)) return path } else return path } throw new