slicing, range and step


/ Published in: Groovy
Save to your folder(s)



Copy this code and paste it in your HTML
  1. list = [1,2,3,4,5,6,7,8,9,10]
  2. list[1..8]
  3. list[(1..8).step(2)]
  4. list[[1, 3, 5, 7]]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.