June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 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