Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/FizzBuzz/ATS/fizzbuzz.ats
Normal file
18
Task/FizzBuzz/ATS/fizzbuzz.ats
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "share/atspre_staload.hats"
|
||||
|
||||
implement main0() = loop(1, 100) where {
|
||||
fun loop(from: int, to: int): void =
|
||||
if from > to then () else
|
||||
let
|
||||
val by3 = (from % 3 = 0)
|
||||
val by5 = (from % 5 = 0)
|
||||
in
|
||||
case+ (by3, by5) of
|
||||
| (true, true) => print_string("FizzBuzz")
|
||||
| (true, false) => print_string("Fizz")
|
||||
| (false, true) => print_string("Buzz")
|
||||
| (false, false) => print_int(from);
|
||||
print_newline();
|
||||
loop(from+1, to)
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue