Repository: incubator-groovy Updated Branches: refs/heads/GROOVY_2_4_X 36880d063 -> d81cac89f
GROOVY-7592: default does not have to be the last label in switch/case statements Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/d81cac89 Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/d81cac89 Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/d81cac89 Branch: refs/heads/GROOVY_2_4_X Commit: d81cac89fe85a01d50a5d32cfadfd864178502a2 Parents: 36880d0 Author: pascalschumacher <pascalschumac...@gmx.net> Authored: Mon Sep 21 19:47:37 2015 +0200 Committer: pascalschumacher <pascalschumac...@gmx.net> Committed: Mon Sep 21 19:48:33 2015 +0200 ---------------------------------------------------------------------- src/spec/doc/core-differences-java.adoc | 4 ---- src/spec/doc/core-semantics.adoc | 2 -- 2 files changed, 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/d81cac89/src/spec/doc/core-differences-java.adoc ---------------------------------------------------------------------- diff --git a/src/spec/doc/core-differences-java.adoc b/src/spec/doc/core-differences-java.adoc index 611fa22..cd60bfd 100644 --- a/src/spec/doc/core-differences-java.adoc +++ b/src/spec/doc/core-differences-java.adoc @@ -346,7 +346,3 @@ variable names etc. * `def` * `in` * `trait` - -== default must be last in switch case - -`default` must go at the end of the switch/case. While in Java the default can be placed anywhere in the switch/case, the `default` in Groovy is used more as an else than assigning a default case. http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/d81cac89/src/spec/doc/core-semantics.adoc ---------------------------------------------------------------------- diff --git a/src/spec/doc/core-semantics.adoc b/src/spec/doc/core-semantics.adoc index 1df7b1e..aeec2f3 100644 --- a/src/spec/doc/core-semantics.adoc +++ b/src/spec/doc/core-semantics.adoc @@ -166,8 +166,6 @@ Switch supports the following kinds of comparisons: * Closure case values match if the calling the closure returns a result which is true according to the <<Groovy-Truth,Groovy truth>> * If none of the above are used then the case value matches if the case value equals the switch value -NOTE: `default` must go at the end of the switch/case. While in Java the default can be placed anywhere in the switch/case, the default in Groovy is used more as an else than assigning a default case. - NOTE: When using a closure case value, the default `it` parameter is actually the switch value (in our example, variable `x`). ==== Looping structures