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;
Apply(func<i32> : i32 f, i32 x) : i32 => f(x);
Main()
{
Console.WriteLine(Apply(x => x + 1, 41));
func<i32, i32> : i32 add = (a, b) => a + b;
func<i32> : func<i32> : i32 times = (i32 a) => b => a * b;
Console.WriteLine(add(2, 3) + " " + times(3)(4));
func greet = () => Console.WriteLine("hi");
greet();
i32 total = 0;
func<i32> collect = x => { total = total + x; };
collect(5);
collect(7);
Console.WriteLine(total);
}
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.