diff --git a/scala.html.markdown b/scala.html.markdown index 6964b9a0..dc039f0c 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -28,9 +28,9 @@ Scala - the scalable language */ -################################################# -## 1. Basics -################################################# +///////////////////////////////////////////////// +// 1. Basics +///////////////////////////////////////////////// // Single line comments start with two forward slashes @@ -138,9 +138,9 @@ val html = """
""" -################################################# -## 2. Functions -################################################# +///////////////////////////////////////////////// +// 2. Functions +///////////////////////////////////////////////// // The next line gives you a function that takes an Int and returns it squared (x:Int) => x * x @@ -165,9 +165,9 @@ sq(10) // Gives you this: res33: Int = 100. val add10: Int => Int = _ + 10 -################################################# -## 3. Flow Control -################################################# +///////////////////////////////////////////////// +// 3. Flow Control +///////////////////////////////////////////////// 1 to 5 val r = 1 to 5 @@ -220,9 +220,9 @@ println(if (x == 10) "yeah" else "nope") val text = if (x == 10) "yeah" else "nope" -################################################# -## 4. Data Structures -################################################# +///////////////////////////////////////////////// +// 4. Data Structures +///////////////////////////////////////////////// val a = Array(1, 2, 3, 5, 8, 13) a(0) @@ -271,9 +271,9 @@ d._1 d._2 -################################################# -## 5. Object Oriented Programming -################################################# +///////////////////////////////////////////////// +// 5. Object Oriented Programming +///////////////////////////////////////////////// /* Aside: Everything we've done so far in this tutorial has been simple @@ -317,9 +317,9 @@ Person("George", "1234") == Person("Kate", "1236") // Objects and traits coming soon! -################################################# -## 6. Pattern Matching -################################################# +///////////////////////////////////////////////// +// 6. Pattern Matching +///////////////////////////////////////////////// val me = Person("George", "1234") @@ -358,9 +358,9 @@ matcher("52917") // => "No match on '52917'" matcher("52752-16432-22178-47917") // => "Serial key: 52752, 16432, 22178, 47917" -################################################# -## 7. Functional Programming -################################################# +///////////////////////////////////////////////// +// 7. Functional Programming +///////////////////////////////////////////////// // Scala allows methods and functions to return, or take as parameters, other // functions or methods. @@ -419,16 +419,16 @@ for { n <- s; nSquared = n * n if nSquared < 10} yield nSquared a for-comprehension defines a relationship between two sets of data. */ -################################################# -## 8. Implicits -################################################# +///////////////////////////////////////////////// +// 8. Implicits +///////////////////////////////////////////////// Coming soon! -################################################# -## 9. Misc -################################################# +///////////////////////////////////////////////// +// 9. Misc +///////////////////////////////////////////////// // Importing things import scala.collection.immutable.List