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;
Kind(any? x) : str => x switch
{
null => "null",
i32 n => "i32 " + n,
str s => "text " + s,
List<i32> l => "a list of " + l.Count,
_ => "something else",
};
Main()
{
Console.WriteLine(Kind(null));
Console.WriteLine(Kind(4));
Console.WriteLine(Kind("hi"));
Console.WriteLine(Kind(newList<i32>()));
Console.WriteLine(Kind(2.5));
str? maybe = "x";
if (maybe isstr text)
Console.WriteLine(text.Length);
if (maybe isnotnull)
Console.WriteLine("has a value");
}
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.