Write Antril, run it in your browser and share it with a link. Programs are compiled to WebAssembly and run on your machine, not on the server.
Running programs is unavailable right now: the WebAssembly linker (wasm-ld, part of LLVM) is not installed on this server. You can still write, share and download code.
importSystem;
intonamespaceTour
{
/// Sums the numbers below `limit` that are multiples of 3 or 5.SumOfMultiples(i32 limit) : i32
{
i32 total = 0;
loop (i32 n = 1..limit)
{
if (n % 3 == 0 || n % 5 == 0)
total += n;
}
return total;
}
Main()
{
i32 result = SumOfMultiples(10);
Console.WriteLine($"The sum is {result}");
}
}
Output
Press Run (or Ctrl+Enter) to compile and run the program.
Input
What Console.ReadLine() reads, one line at a time.
Ctrl+Enter runs. Tab indents (Shift+Tab outdents); press Esc, then Tab, to leave the editor. A program may run for 10 seconds.