1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-05 14:27:51 +02:00

scala: consistent code format

This commit is contained in:
Ha-Duong, NGUYEN
2015-08-03 15:58:36 +07:00
parent 513235c475
commit d61ad10775

View File

@@ -178,7 +178,7 @@ addWithDefault(1) // => 6
// Anonymous functions look like this: // Anonymous functions look like this:
(x:Int) => x * x (x: Int) => x * x
// Unlike defs, even the input type of anonymous functions can be omitted if the // Unlike defs, even the input type of anonymous functions can be omitted if the
// context makes it clear. Notice the type "Int => Int" which means a function // context makes it clear. Notice the type "Int => Int" which means a function
@@ -248,7 +248,7 @@ do {
// Tail recursion is an idiomatic way of doing recurring things in Scala. // 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. // Recursive functions need an explicit return type, the compiler can't infer it.
// Here it's Unit. // Here it's Unit.
def showNumbersInRange(a:Int, b:Int): Unit = { def showNumbersInRange(a: Int, b: Int): Unit = {
print(a) print(a)
if (a < b) if (a < b)
showNumbersInRange(a + 1, b) showNumbersInRange(a + 1, b)