Skip to content

Instantly share code, notes, and snippets.

@danker
Created November 9, 2010 02:19
Show Gist options
  • Save danker/668611 to your computer and use it in GitHub Desktop.
Save danker/668611 to your computer and use it in GitHub Desktop.
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 ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment