Skip to content

Commit a352db3

Browse files
author
mdodsworth
committed
completing pattern matching
1 parent fe06408 commit a352db3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

for-loop-messing.scala

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object ForLoopPlaying {
2+
def main(args:Array[String]) = {
3+
for (string <- args
4+
if string.length > 3;
5+
if string.length < 5) println(string)
6+
}
7+
}

pattern-matching.scala

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import scala.util.Random
2+
3+
val randomNum = new Random() nextInt 10
4+
5+
randomNum match {
6+
case 7 => println("lucky 7!")
7+
case anythingElse => println(anythingElse + " is a terrible number!")
8+
}

0 commit comments

Comments
 (0)