From: No-one-you-know Date: Fri, 19 Feb 2021 05:14:37 +0000 (+0000) Subject: Added Lua fizzbuzz example X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=7be62c67160dfa1f7fea109f22ec755b16d7827b;p=langlearn%2F.git Added Lua fizzbuzz example --- diff --git a/fizzbuzz/lua/MaximumGeeker/fizzbuzz.lua b/fizzbuzz/lua/MaximumGeeker/fizzbuzz.lua new file mode 100644 index 0000000..a4c6a65 --- /dev/null +++ b/fizzbuzz/lua/MaximumGeeker/fizzbuzz.lua @@ -0,0 +1,23 @@ +--[[ FizzBuzz, Lua 5.1 ]]-- + +local ans = { + 'Fizz', + 'Buzz', + 'FizzBuzz' +} + +for i = 1, 100 do + local c = 0 + + if i%3 == 0 then + c = c + 1 + end + + if i%5 == 0 then + c = c + 2 + end + + if ans[c] then + print( i, ans[c] ) + end +end