Last active
July 21, 2016 15:26
-
-
Save fluency03/6f0a9b6193861b1b0df0506f1ff250b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a Scala script: scala-loop-func.scala | |
*/ | |
def printArgs1(args: Array[String]): Unit = { | |
var i = 0 | |
while (i < args.length) { | |
println(args(i)) | |
i += 1 | |
} | |
} | |
def printArgs2(args: Array[String]): Unit = { | |
for (arg <- args) | |
println(arg) | |
} | |
def printArgs3(args: Array[String]): Unit = { | |
args.foreach(println) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment