aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/abigail/lua/ch-2.lua
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-001/abigail/lua/ch-2.lua')
-rw-r--r--challenge-001/abigail/lua/ch-2.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-001/abigail/lua/ch-2.lua b/challenge-001/abigail/lua/ch-2.lua
new file mode 100644
index 0000000000..749cdcd444
--- /dev/null
+++ b/challenge-001/abigail/lua/ch-2.lua
@@ -0,0 +1,25 @@
+--
+-- See ../README.md
+--
+
+--
+-- Run as: lua ch-2.lua < input-file
+--
+
+for line in io . lines () do
+ for i = 1, line do
+ if i % 15 == 0
+ then
+ out = "fizzbuzz"
+ elseif i % 5 == 0
+ then
+ out = "buzz"
+ elseif i % 3 == 0
+ then
+ out = "fizz"
+ else
+ out = i
+ end
+ io . write (out, "\n")
+ end
+end