Skip to content

Instantly share code, notes, and snippets.

@seanjensengrey
Created April 9, 2014 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanjensengrey/10327818 to your computer and use it in GitHub Desktop.
Save seanjensengrey/10327818 to your computer and use it in GitHub Desktop.
If free FizzBuzz in Lua
t = { [true] = {} , [false] = {}}
t[false][false] = function(x) return x end
t[true][false] = function(x) return "Fizz" end
t[false][true] = function(x) return "Buzz" end
t[true][true] = function(x) return "FizzBuzz" end
for i = 1, 100 do
print(t[i % 3 == 0][i % 5 == 0](i))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment