Guest User

Untitled

a guest
Jun 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. 100.times {
  2.  
  3. displayNum = ++it
  4. def matched = false
  5.  
  6. if ((displayNum % 3) == 0) {
  7. print "FIZZ"
  8. matched = true
  9. }
  10.  
  11. if ((displayNum % 5) == 0) {
  12. if (matched) print "-"
  13. print "BUZZ"
  14. matched = true
  15. }
  16.  
  17. if (!matched) {
  18. println displayNum
  19. } else {
  20. println ""
  21. }
  22. }
Add Comment
Please, Sign In to add comment