diff options
| author | Zachary Ferguson <zfergus2@users.noreply.github.com> | 2015-10-15 14:48:59 -0400 | 
|---|---|---|
| committer | Zachary Ferguson <zfergus2@users.noreply.github.com> | 2015-10-15 14:48:59 -0400 | 
| commit | 65bb71f4bde383a4d0b8cd6fd49901bb6e2cfa5f (patch) | |
| tree | 03802f50ac31b295ace0585ccb6bc1ea6ef9b612 /scala.html.markdown | |
| parent | a4ea3961744c3c1ee6fcf654f011caa8dbadf56e (diff) | |
| parent | 68953bd9d97328b8660dad06edd8acb8ff330ede (diff) | |
Merge remote-tracking branch 'refs/remotes/adambard/master'
Conflicts:
	c.html.markdown
Diffstat (limited to 'scala.html.markdown')
| -rw-r--r-- | scala.html.markdown | 16 | 
1 files changed, 10 insertions, 6 deletions
| diff --git a/scala.html.markdown b/scala.html.markdown index c482752d..7f545196 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -6,7 +6,6 @@ contributors:      - ["Dominic Bou-Samra", "http://dbousamra.github.com"]      - ["Geoff Liu", "http://geoffliu.me"]      - ["Ha-Duong Nguyen", "http://reference-error.org"] -filename: learn.scala  ---  Scala - the scalable language @@ -43,9 +42,13 @@ Scala - the scalable language  // Printing, and forcing a new line on the next print  println("Hello world!")  println(10) +// Hello world! +// 10  // Printing, without forcing a new line on next print  print("Hello world") +print(10) +// Hello world!10  // Declaring values is done using either var or val.  // val declarations are immutable, whereas vars are mutable. Immutability is @@ -240,10 +243,11 @@ i    // Show the value of i. Note that while is a loop in the classical sense -       // comprehensions above is easier to understand and parallelize  // A do while loop +i = 0  do { -  println("x is still less than 10") -  x += 1 -} while (x < 10) +  println("i is still less than 10") +  i += 1 +} while (i < 10)  // Tail recursion is an idiomatic way of doing recurring things in Scala.  // Recursive functions need an explicit return type, the compiler can't infer it. @@ -562,8 +566,8 @@ sendGreetings("Jane")  // => "Hello Jane, 100 blessings to you and yours!"  // Implicit function parameters enable us to simulate type classes in other  // functional languages. It is so often used that it gets its own shorthand. The  // following two lines mean the same thing: -def foo[T](implicit c: C[T]) = ... -def foo[T : C] = ... +// def foo[T](implicit c: C[T]) = ... +// def foo[T : C] = ...  // Another situation in which the compiler looks for an implicit is if you have | 
