{"id":528,"date":"2023-11-26T15:32:54","date_gmt":"2023-11-26T15:32:54","guid":{"rendered":"https:\/\/javigomez.org\/?p=528"},"modified":"2025-09-29T20:33:44","modified_gmt":"2025-09-29T20:33:44","slug":"u04-04-salidas-anticipadas","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2023\/11\/26\/u04-04-salidas-anticipadas\/","title":{"rendered":"U04-04-Salidas anticipadas"},"content":{"rendered":"\n<p>En Java, break y continue son dos palabras clave utilizadas en bucles para controlar el flujo de ejecuci\u00f3n.<\/p>\n\n\n\n<p><strong>break<\/strong>:<br>La palabra clave break se utiliza para salir inmediatamente de un bucle, ya sea un bucle for, while o do-while.<\/p>\n\n\n\n<p><strong>continue<\/strong>:<br>La palabra clave continue se utiliza para saltar a la siguiente iteraci\u00f3n del bucle sin ejecutar el resto del c\u00f3digo dentro del bucle para la iteraci\u00f3n actual. Es decir, cuando se encuentra la declaraci\u00f3n continue, el programa salta al final del bucle y pasa a la siguiente iteraci\u00f3n.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>i = 1; \nwhile (i &lt;= 10) { \n  System.out.println(\"La i vale\" + i); \n  if (i == 2) { \n    break; \n  } \n  i++; \n}\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\t\tfor (int i = 0; i &lt; 10; i++) {\n\t\t\tif (i == 5)\n\t\t\t\tcontinue;\n\t\t\tSystem.out.println(i);\n\t\t\t\n\t\t}<\/code><\/pre>\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=\"Java U04 04 salidasAnticipadas\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/evP_5ukL7Jc?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>En Java, break y continue son dos palabras clave utilizadas en bucles para controlar el flujo de ejecuci\u00f3n. break:La palabra clave break se utiliza para &hellip; <\/p>\n","protected":false},"author":1,"featured_media":529,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[58,96,161,203,350],"class_list":["post-528","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-break","tag-continue","tag-for","tag-java","tag-while"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/528","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=528"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/528\/revisions"}],"predecessor-version":[{"id":916,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/528\/revisions\/916"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/529"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}