Flow Control
retornar (return)
Section titled “retornar (return)”Ends a function and returns a value. In vacio type functions it can be omitted.
texto saludar(texto nombre) { retornar t"Hola, {nombre}"}Object constructors do not allow retornar; the implicit value is always vacio.
romper (break)
Section titled “romper (break)”Immediately exits the current loop (para, mientras, hacer ... mientras, or iterations with en/cada).
entero var contador = 0mientras (contador < 10) { si (contador == 5) { romper } contador++}continuar (continue)
Section titled “continuar (continue)”Skips the rest of the current block and evaluates the next loop iteration.
// Reserved word 'continuar', continues to the next loop iterationpara (entero var i = 0; i < 10; i++) { si (i % 2 == 0) { // If the number is even, skip printing and continue to next iteration continuar } consola.mostrar(i)}lanzar (throw)
Section titled “lanzar (throw)”Generates an exception that can be caught higher up in the call stack.
numero dividir(numero a, numero b) { si (b == 0) { lanzar "Division by zero" } retornar a / b}intentar, capturar, finalmente (try, catch, finally)
Section titled “intentar, capturar, finalmente (try, catch, finally)”Handle exceptions generated within the intentar block. The capturar parameter must use the excepcion type.
intentar { numero resultado = dividir(10, 0) consola.mostrar(resultado.texto())} capturar (excepcion error) { consola.mostrar_error(error.mensaje)} finalmente { consola.mostrar("Operation finished")}esperar (await) - Reserved
Section titled “esperar (await) - Reserved”The esperar keyword is reserved for future asynchronous function execution. In v0.0.2 it is not yet fully enabled.
Program Exit Flow
Section titled “Program Exit Flow”The interpreter does not include explicit instructions like exit or quit. To finish, simply allow the program to reach the end of the file or use retornar at the entry point if your application is organized within a main function.
These tools, combined with conditionals and loops, allow you to control your programs’ behavior.