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:09:40 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 2359b538e -> ff4eb69dd


range clarification


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

Branch: refs/heads/GROOVY_2_6_X
Commit: ff4eb69dd34fdde2cb924235b6f6d3898fa5d67d
Parents: d474358
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:09: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/ff4eb69d/src/spec/doc/style-guide.adoc
----------------------------------------------------------------------
diff --git a/src/spec/doc/style-guide.adoc b/src/spec/doc/style-guide.adoc
index ed56c21..2ee13cc 100644
--- a/src/spec/doc/style-guide.adoc
+++ b/src/spec/doc/style-guide.adoc
@@ -492,7 +492,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