From 7673ae8a6dc79fdc8f555d8e0c64834af17403d1 Mon Sep 17 00:00:00 2001 From: George Petrov Date: Mon, 29 Jul 2013 09:29:14 +0100 Subject: [PATCH] Added arrays and maps --- scala.html.markdown | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scala.html.markdown b/scala.html.markdown index f087881a..82bf9db2 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -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 \ No newline at end of file