diff options
author | Elijah Karari <eljhkrr@gmail.com> | 2015-11-02 15:52:27 +0300 |
---|---|---|
committer | Elijah Karari <eljhkrr@gmail.com> | 2015-11-02 15:52:27 +0300 |
commit | 344518d2f60c6373f7814752fc53ef5603b605a9 (patch) | |
tree | 7e48a776ab06c741475b2189527b60a30d291ca8 /scala.html.markdown | |
parent | edfc99e198fd2e87802ea81d6779fbadfab64919 (diff) | |
parent | 824869ef99de73e87ef791bac880f4575cc9ddc9 (diff) |
Merge pull request #2 from adambard/master
Update my fork to upstream
Diffstat (limited to 'scala.html.markdown')
-rw-r--r-- | scala.html.markdown | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scala.html.markdown b/scala.html.markdown index 192e03d7..bc8cd422 100644 --- a/scala.html.markdown +++ b/scala.html.markdown @@ -169,6 +169,12 @@ def sumOfSquaresShort(x: Int, y: Int): Int = x * x + y * y // Syntax for calling functions is familiar: sumOfSquares(3, 4) // => 25 +// You can use parameters names to specify them in different order +def subtract(x: Int, y: Int): Int = x - y + +subtract(10, 3) // => 7 +subtract(y=10, x=3) // => -7 + // In most cases (with recursive functions the most notable exception), function // return type can be omitted, and the same type inference we saw with variables // will work with function return values: |