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;
importSystem.Reflection;
intonamespaceShapes
{
/// A circle of a radius.publicclassCircle
{
public:
/// The radius.f64Radius;
new() { Radius = 2.0; }
/// Three times the radius squared.Area() : f64 => 3.0 * Radius * Radius;
}
Main()
{
loop (Assembly a inAssembly.Loaded)
Console.WriteLine(a.FullName + " " + a.GetTypes().Length);
if (Type.Find("Shapes.Circle") isType circle && circle.GetMethod("Area") isMethodInfo area)
{
Console.WriteLine(circle.Documentation ?? "-");
Console.WriteLine(area.Name + ": " + (area.Documentation ?? "-"));
any made = Activator.CreateInstance(circle);
Console.WriteLine(area.Invoke(made, []) isf64 value ? value : -1.0);
}
}
}
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.