groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [1/2] groovy git commit: range clarification
Date Tue, 07 Nov 2017 02:10:37 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X ed69389a6 -> e704a7ce9


range clarification


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e704a7ce
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e704a7ce
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e704a7ce

Branch: refs/heads/GROOVY_2_4_X
Commit: e704a7ce96b344c3272d1e3ea838b94346184ef2
Parents: 169ff8f
Author: paulk <paulk@asert.com.au>
Authored: Tue Nov 7 12:08:01 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Tue Nov 7 12:10:24 2017 +1000

----------------------------------------------------------------------
 src/spec/doc/style-guide.adoc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e704a7ce/src/spec/doc/style-guide.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/style-guide.adoc b/src/spec/doc/style-guide.adoc
index 47fba4e..e1a8a3f 100644
--- a/src/spec/doc/style-guide.adoc
+++ b/src/spec/doc/style-guide.adoc
@@ -471,7 +471,12 @@ def list = [1, 4, 6, 9]
 // you can wrap keys with () like [(variableStateAcronym): stateName] to insert a variable
or object as a key.
 def map = [CA: 'California', MI: 'Michigan']
 
-def range = 10..20
+// ranges can be inclusive and exclusive
+def range = 10..20 // inclusive
+assert range.size() == 21
+// use brackets if you need to call a method on a range definition
+assert (10..<20).size() == 20 // exclusive
+
 def pattern = ~/fo*/
 
 // equivalent to add()


Mime
View raw message