Skip to content

Instantly share code, notes, and snippets.

@RuizuKun-Dev
Last active April 1, 2023 00:52
Show Gist options
  • Save RuizuKun-Dev/b73d7fc5e09f2eb6c2601a8bef28a444 to your computer and use it in GitHub Desktop.
Save RuizuKun-Dev/b73d7fc5e09f2eb6c2601a8bef28a444 to your computer and use it in GitHub Desktop.
This is my fizz buzz implementation
local list = {
{word = "Fizz", number = 3},
{word = "Buzz", number = 5},
}
local function fizzbuzz(iterations)
for i = 1, iterations do
local str = i..": "
for _, data in pairs(list) do
if i % data.number == 0 then
str = str..""..data.word
end
end
print(str)
end
end
fizzbuzz(100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment