Escribe Antril, ejecútalo en tu navegador y compártelo con un enlace. Los programas se compilan a WebAssembly y se ejecutan en tu equipo, no en el servidor.
Ejecutar programas no está disponible en este momento: the WebAssembly linker (wasm-ld, part of LLVM) is not installed on this server. Aún puedes escribir, compartir y descargar código.
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);
}
Salida
Pulsa Ejecutar (o Ctrl+Enter) para compilar y ejecutar el programa.
Entrada
Lo que lee Console.ReadLine(), una línea a la vez.
Ctrl+Enter ejecuta. Tab agrega sangría (Shift+Tab la quita); pulsa Esc y luego Tab para salir del editor. Un programa puede ejecutarse durante 10 segundos.