Skip to content

Instantly share code, notes, and snippets.

@YordanGeorgiev
Created February 17, 2018 10:06
Show Gist options
  • Save YordanGeorgiev/fd8ef36204fb09ceebdfa6c67bd0ca60 to your computer and use it in GitHub Desktop.
Save YordanGeorgiev/fd8ef36204fb09ceebdfa6c67bd0ca60 to your computer and use it in GitHub Desktop.
[foreach loop with var] how-to assign a var into scala foreach loop #scala
// how-to assign var in foreach loop
val objFileHandler = new FileHandler ()
objFileHandler.getFileTree( new File ( dataCsvDir ) )
.filter(_.getName.endsWith(".csv"))
.foreach{
x => {
var f = x;
println ( f.toString() )
/* some operation */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment