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;
intonamespaceGeometry
{
publicvalueSize
{
public:
i32Width;
i32Height;
// No body: each parameter is stored in the field of the same name.new(i32Width, i32Height);
// Calls the other constructor.new(i32 side) : (side, side);
i32Area { get => Width * Height; }
}
publicclassLabel
{
readonlystr text;
public:
new(str text) { this.text = text; }
overrideToString() : str => "[" + text + "]";
}
Main()
{
Size square = newSize(4);
Console.WriteLine(square.Area);
Console.WriteLine(newLabel("ok"));
}
}
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.