Guest User

Untitled

a guest
Jun 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. (1..100).collect{ x ->
  2. switch([x % 3, x % 5]) {
  3. case {it[0] == 0 && it[1] == 0} : return 'FizzBuzz'
  4. case {it[0] == 0 } : return 'Fizz'
  5. case { it[1] == 0} : return 'Buzz'
  6. default : return x.toString()
  7. }
  8. }.each{ println it }
Add Comment
Please, Sign In to add comment