Created
August 25, 2013 23:01
-
-
Save peysal/6336828 to your computer and use it in GitHub Desktop.
introduction to groovy
1) range declaration
2) iterate range
3) contains and reverse
4) size, from, to
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def myRange = 1..3 | |
| assert myRange.size() == 3 | |
| (1..3).each{it -> println it} //iterate range | |
| myRange.each{println it} | |
| assert myRange.from == 1 | |
| assert myRange.to == 3 | |
| assert myRange.contains(2) | |
| assert myRange.reverse() == [3,2,1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment