summaryrefslogtreecommitdiffhomepage
path: root/scala.html.markdown
diff options
context:
space:
mode:
authorJacob Ward <jacobward1898@gmail.com>2015-10-31 20:27:51 -0600
committerJacob Ward <jacobward1898@gmail.com>2015-10-31 20:27:51 -0600
commit5d09566ee4881028cd53dee83ae27343beb8269d (patch)
treed5d48488f23e08690f1ec54610c9fe81e34d2fe8 /scala.html.markdown
parent08b43e21f1a273d5ca471e0accdf46ba706a4cd5 (diff)
parentdbe6184519860e526432c4987a6f67d6c0acf38e (diff)
Merge remote-tracking branch 'adambard/master'
Diffstat (limited to 'scala.html.markdown')
-rw-r--r--scala.html.markdown6
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: