Skip to content

Instantly share code, notes, and snippets.

@peysal
Created August 25, 2013 23:01
Show Gist options
  • Select an option

  • Save peysal/6336828 to your computer and use it in GitHub Desktop.

Select an option

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
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