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;
MinMax(i32[] values) : (i32, i32)
{
i32 low = values[0], high = values[0];
loop (i32 v in values)
{
if (v < low)
low = v;
if (v > high)
high = v;
}
return (low, high);
}
Main()
{
(i32, i32) range = MinMax([4, 9, 1, 7]);
Console.WriteLine(range);
Console.WriteLine(range.Item2 - range.Item1);
(i32, str) pair = (1, "one");
if (pair is (1, var word))
Console.WriteLine(word);
Dictionary<(i32, i32), str> grid = newDictionary<(i32, i32), str>();
grid[(0, 1)] = "a";
Console.WriteLine(grid[(0, 1)]);
}
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.