1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-19 04:52:13 +02:00

Fix compile errors of the English and French Scala tutorials

This commit is contained in:
João Costa
2015-10-10 16:49:53 +01:00
parent d8a1c0cf6a
commit 7c2c448060
2 changed files with 12 additions and 9 deletions

View File

@@ -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
@@ -244,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.
@@ -566,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