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;
intonamespaceMath2
{
Square(i32 x) : i32
{
return x * x;
}
// A body that is a single expression.Cube(i32 x) : i32 => x * x * x;
Report(str label, i32 value)
{
Console.WriteLine(label + ": " + value);
}
// Overloads: same name, different parameters.Describe(i32 x) : str => "the number " + x;
Describe(str s) : str => "the text " + s;
Main()
{
Report("square", Square(4));
Report("cube", Cube(3));
Console.WriteLine(Describe(7));
Console.WriteLine(Describe("seven"));
}
}
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.