Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 100.times {
- displayNum = ++it
- def matched = false
- if ((displayNum % 3) == 0) {
- print "FIZZ"
- matched = true
- }
- if ((displayNum % 5) == 0) {
- if (matched) print "-"
- print "BUZZ"
- matched = true
- }
- if (!matched) {
- println displayNum
- } else {
- println ""
- }
- }
Add Comment
Please, Sign In to add comment