projects
/
langlearn
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added Lua fizzbuzz example
[langlearn/.git]
/
fizzbuzz
/
lua
/
MaximumGeeker
/
fizzbuzz.lua
diff --git a/fizzbuzz/lua/MaximumGeeker/fizzbuzz.lua
b/fizzbuzz/lua/MaximumGeeker/fizzbuzz.lua
new file mode 100644
(file)
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