summaryrefslogtreecommitdiffhomepage
path: root/scala.html.markdown
diff options
context:
space:
mode:
authorGeorge Petrov <petrovg@gmail.com>2013-07-29 09:29:14 +0100
committerGeorge Petrov <petrovg@gmail.com>2013-07-29 09:29:14 +0100
commit7673ae8a6dc79fdc8f555d8e0c64834af17403d1 (patch)
tree26d41683cda0cb1d7738b88177a46812455ec7a0 /scala.html.markdown
parent2e7c3ba085da91a198f7b339d57bdf1fd8c8b49c (diff)
Added arrays and maps
Diffstat (limited to 'scala.html.markdown')
-rw-r--r--scala.html.markdown13
1 files changed, 13 insertions, 0 deletions
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