diff options
author | Robert Hoedicke <robert@duckbuddha.com> | 2014-10-10 05:21:22 +0200 |
---|---|---|
committer | Robert Hoedicke <robert@duckbuddha.com> | 2014-10-10 05:21:22 +0200 |
commit | 3bbf5e4ed08c9a9c6153bb6373627428702cf6f4 (patch) | |
tree | 6b2de6f664898185838d8a20aaa4445a8d745258 /spec | |
parent | ae65b95e1bfdc1b6d578914e519b20b008494417 (diff) | |
download | scala-3bbf5e4ed08c9a9c6153bb6373627428702cf6f4.tar.gz scala-3bbf5e4ed08c9a9c6153bb6373627428702cf6f4.tar.bz2 scala-3bbf5e4ed08c9a9c6153bb6373627428702cf6f4.zip |
Update 04-basic-declarations-and-definitions.md
Reverted the claimed result values of the example in the section on repeated parameters and changed the code of the example method instead.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/04-basic-declarations-and-definitions.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/04-basic-declarations-and-definitions.md b/spec/04-basic-declarations-and-definitions.md index ad51182dec..aca1c63d22 100644 --- a/spec/04-basic-declarations-and-definitions.md +++ b/spec/04-basic-declarations-and-definitions.md @@ -720,13 +720,13 @@ variable number of integer arguments. ```scala def sum(args: Int*) = { var result = 0 - for (arg <- args) result += arg * arg + for (arg <- args) result += arg result } ``` The following applications of this method yield `0`, `1`, -`14`, in that order. +`6`, in that order. ```scala sum() @@ -747,7 +747,7 @@ sum(xs) // ***** error: expected: Int, found: List[Int] ``` By contrast, the following application is well formed and yields again -the result `14`: +the result `6`: ```scala sum(xs: _*) |