diff options
| author | 冯昶 <seaker@qq.com> | 2021-03-15 18:13:51 +0800 |
|---|---|---|
| committer | 冯昶 <seaker@qq.com> | 2021-03-15 18:13:51 +0800 |
| commit | 8b6be37fe4dac8b4c6489a95e55514b76b298d15 (patch) | |
| tree | ae36c8ec2c71f606c0e36adaa19dba366a68a0b4 /challenge-001/abigail/lua | |
| parent | 865acfd056fb6f409ec6b1a81d60b931cbcb69fe (diff) | |
| parent | c9aec2da6bcb04b488183f09ca94bee488557aff (diff) | |
| download | perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.tar.gz perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.tar.bz2 perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.zip | |
Merge branch 'master' of github.com:seaker/perlweeklychallenge-club
Diffstat (limited to 'challenge-001/abigail/lua')
| -rw-r--r-- | challenge-001/abigail/lua/ch-1.lua | 12 | ||||
| -rw-r--r-- | challenge-001/abigail/lua/ch-2.lua | 25 |
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-001/abigail/lua/ch-1.lua b/challenge-001/abigail/lua/ch-1.lua new file mode 100644 index 0000000000..2876669f0d --- /dev/null +++ b/challenge-001/abigail/lua/ch-1.lua @@ -0,0 +1,12 @@ +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-1.lua < input-file +-- + +for line in io . lines () do + line, count = string . gsub (line, "e", "E"); + io . write (line, "\n", count, "\n") +end 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 |
