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;
publicrecordvaluePoint
{
public:
i32X;
i32Y;
new(i32X, i32Y);
}
Where(Point p) : str => p switch
{
(0, 0) => "origin",
Point(0, var y) => "on the Y axis at " + y,
(var x, 0) => "on the X axis at " + x,
{ X: > 0, Y: > 0 } => "first quadrant",
_ => "elsewhere",
};
Main()
{
Console.WriteLine(Where(newPoint(0, 0)));
Console.WriteLine(Where(newPoint(0, 5)));
Console.WriteLine(Where(newPoint(3, 0)));
Console.WriteLine(Where(newPoint(1, 2)));
Console.WriteLine(Where(newPoint(-1, 2)));
Console.WriteLine((1, "a") is (1, _));
}
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.