> For the complete documentation index, see [llms.txt](https://educacion.gitbook.io/programacion/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://educacion.gitbook.io/programacion/ud2-programacion-estructurada/programacion-estructurada.md).

# Programación estructurada

<figure><img src="/files/4LGVhe4ONgHAq0QsOCWP" alt=""><figcaption></figcaption></figure>

É un paradigma de programación basado en dividir o programa nun conxunto de estruturas claramente definidas, cun punto de entrada, outro de saída, independentemente de que no medio haxa novos camiños. Baséase no uso de tres estruturas básicas:

* **Secuencia**: As instruccións executanse na orde na que estan escritas no código
* **Selección:** Este codigo bifurcase en ramas diferenciadas, e en cada execución bifurcarase por unha ou por outra en función de certas condicións (if, switch).
* **Iteración:** A iteración permite a repetición de instrucións un número de veces (for, while, do - while)

O obxectivo deste paradigma é mellorar a claridade, calidade e tempo de desenvolvemento do código, eliminando sentenzas de saltos incontrolados como GOTO, que terminan xerando código espaguetti.

{% hint style="warning" %}
**Teorema da programación estructurada**

Toda función computable pode ser interpretada nunha linguaxe de programación que combine só tres estruturas lóxicas: secuencia, selección e iteración.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://educacion.gitbook.io/programacion/ud2-programacion-estructurada/programacion-estructurada.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
