Added arrays and maps

This commit is contained in:
George Petrov 2013-07-29 09:29:14 +01:00
parent 2e7c3ba085
commit 7673ae8a6d

View File

@ -51,3 +51,16 @@ val sq = (x:Int) => x * x
sq(10) // Gives you this: res33: Int = 100. The result is the Int with a value 100
// Data structures
val a = Array(1, 2, 3, 5, 8, 13)
a(0)
a(3)
a(21) // Throws an exception
val m = Map("fork" -> "tenedor", "spoon" -> "cuchara", "knife" -> "cuchillo")
m("fork")
m("spoon")
m("bottle") // Throws an exception