Repository: groovy Updated Branches: refs/heads/master e0b473cfb -> e674d77f8
range clarification Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e674d77f Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e674d77f Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e674d77f Branch: refs/heads/master Commit: e674d77f829e804f92a48c815eb681cca471af29 Parents: d5fb637 Author: paulk <[email protected]> Authored: Tue Nov 7 12:08:01 2017 +1000 Committer: paulk <[email protected]> Committed: Tue Nov 7 12:08:19 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/e674d77f/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()
