{"id":383,"date":"2023-09-09T15:21:03","date_gmt":"2023-09-09T15:21:03","guid":{"rendered":"https:\/\/javigomez.org\/?p=383"},"modified":"2025-09-29T20:33:56","modified_gmt":"2025-09-29T20:33:56","slug":"04-pseint-iteraciones","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2023\/09\/09\/04-pseint-iteraciones\/","title":{"rendered":"04. PSeInt &#8211; Iteraciones"},"content":{"rendered":"\n<p><strong>Iteraci\u00f3n con salida al principio (while): <\/strong>primeramente, eval\u00faa la condici\u00f3n y en caso de cumplirse ejecuta el bloque de instrucciones. La condici\u00f3n deber\u00e1 cambiar de valor seg\u00fan las instrucciones contenidas para evitar bucles infinitos.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-8-1-1.png\" alt=\"\" class=\"wp-image-384\" style=\"width:261px;height:223px\" width=\"261\" height=\"223\"\/><\/figure>\n\n\n\n<p><strong>Iteraci\u00f3n con salida al final (repeat y do while): <\/strong>primeramente, ejecuta el bloque de instrucciones y posteriormente eval\u00faa la condici\u00f3n. La condici\u00f3n deber\u00e1 cambiar de valor seg\u00fan las instrucciones contenidas para evitar bucles infinitos. El bloque de instrucciones se ejecutar\u00e1, como m\u00ednimo, una vez.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-9-1-1.png\" alt=\"\" class=\"wp-image-385\"\/><\/figure>\n\n\n\n<p><strong>Iteraci\u00f3n con contador (for)<\/strong>: ejecutar\u00e1 el bloque de instrucciones un n\u00famero determinado de iteraciones. Hace uso de una variable que ir\u00e1 incrementando o decrementando por cada iteraci\u00f3n hasta que se cumpla la condici\u00f3n de salida. La condici\u00f3n de control, que se traducir\u00e1 a i==N o i==1 seg\u00fan sea el incremento, deber\u00e1 ser falsa para que sigan ejecut\u00e1ndose las instrucciones<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-1-10-1-1.png\" alt=\"\" class=\"wp-image-386\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-1-11-1-1.png\" alt=\"\" class=\"wp-image-387\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-1-12-1-1.png\" alt=\"\" class=\"wp-image-388\" style=\"width:501px;height:165px\" width=\"501\" height=\"165\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-1-13-1-1.png\" alt=\"\" class=\"wp-image-389\"\/><\/figure>\n\n\n\n<p><strong>Iteraci\u00f3n para cada (for each)<\/strong>: ejecutar\u00e1 el bloque de instrucciones para cada elemento contenido en un conjunto<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/09\/image-42-1-14-1-1.png\" alt=\"\" class=\"wp-image-390\" style=\"width:460px;height:355px\" width=\"460\" height=\"355\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"PSeInt U01 04 Repetitivas\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/pYNpBrMhGw0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Iteraci\u00f3n con salida al principio (while): primeramente, eval\u00faa la condici\u00f3n y en caso de cumplirse ejecuta el bloque de instrucciones. La condici\u00f3n deber\u00e1 cambiar de &hellip; <\/p>\n","protected":false},"author":1,"featured_media":376,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[161,234,255,256,271,272,287,288,350],"class_list":["post-383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pseint-pseudocodigo","tag-for","tag-mientras","tag-para","tag-para-cada","tag-pseint","tag-pseudocodigo","tag-repeat","tag-repetir","tag-while"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"predecessor-version":[{"id":937,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/383\/revisions\/937"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/376"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}