Data update
This commit is contained in:
parent
aec8ed51b6
commit
29a5eea0d4
128 changed files with 1298 additions and 0 deletions
19
Task/FizzBuzz/Gleam/fizzbuzz.gleam
Normal file
19
Task/FizzBuzz/Gleam/fizzbuzz.gleam
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import gleam/int
|
||||
import gleam/io
|
||||
import gleam/iterator
|
||||
|
||||
pub fn main() {
|
||||
iterator.range(1, 101)
|
||||
|> iterator.map(to_fizzbuzz)
|
||||
|> iterator.map(io.println)
|
||||
|> iterator.run
|
||||
}
|
||||
|
||||
fn to_fizzbuzz(n: Int) -> String {
|
||||
case n % 3, n % 5 {
|
||||
0, 0 -> "FizzBuzz"
|
||||
0, _ -> "Fizz"
|
||||
_, 0 -> "Buzz"
|
||||
_, _ -> int.to_string(n)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue