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;
Main()
{
loop (i32 i = 0..3)
{
try
{
if (i == 0)
thrownewKeyNotFoundError();
if (i == 1)
thrownewInvalidOperationError("bad state");
Int32.Parse("x");
}
catch (KeyNotFoundError)
{
Console.WriteLine("missing key");
}
catch (InvalidOperationError e)
{
Console.WriteLine("invalid: " + e.Message);
}
catch
{
Console.WriteLine("anything else");
}
}
}
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.