aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/abigail/lua/ch-2.lua
blob: 6ff4727fc5cefd22fe71dc9045c360070886f186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--
-- See https://theweeklychallenge.org/blog/perl-weekly-challenge-001
--

--
-- 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