Last active
April 1, 2023 00:52
-
-
Save RuizuKun-Dev/b73d7fc5e09f2eb6c2601a8bef28a444 to your computer and use it in GitHub Desktop.
This is my fizz buzz implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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