{"id":39827,"date":"2026-02-24T11:41:18","date_gmt":"2026-02-24T08:41:18","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=39827"},"modified":"2026-02-24T11:41:18","modified_gmt":"2026-02-24T08:41:18","slug":"javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/","title":{"rendered":"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131"},"content":{"rendered":"<p><body><\/p>\n<h2>JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131<\/h2>\n<p>Programlamada belirli bir kod blo\u011funu birden fazla kez \u00e7al\u0131\u015ft\u0131rma ihtiyac\u0131 s\u0131k\u00e7a do\u011far. Bu tekrarlayan g\u00f6revleri otomatikle\u015ftirmek i\u00e7in d\u00f6ng\u00fcler (loops) kullan\u0131l\u0131r. JavaScript&#8217;te yayg\u0131n olarak kullan\u0131lan d\u00f6ng\u00fc t\u00fcrlerinden ikisi <code>while<\/code> ve <code>do...while<\/code> d\u00f6ng\u00fcleridir. Bu rehberde, her iki d\u00f6ng\u00fcn\u00fcn nas\u0131l \u00e7al\u0131\u015ft\u0131\u011f\u0131n\u0131, s\u00f6zdizimlerini, \u00f6rneklerini ve hangi senaryolarda tercih edilmeleri gerekti\u011fini detayl\u0131 bir \u015fekilde inceleyece\u011fiz.<\/p>\n<h3>D\u00f6ng\u00fcler Neden \u00d6nemlidir?<\/h3>\n<p>D\u00f6ng\u00fcler, kod tekrar\u0131n\u0131 azalt\u0131r, programlar\u0131 daha verimli ve okunabilir hale getirir. \u00d6rne\u011fin, bir listedeki t\u00fcm elemanlar\u0131 i\u015flemek, kullan\u0131c\u0131dan ge\u00e7erli bir girdi al\u0131nana kadar tekrar tekrar sormak veya belirli bir ko\u015ful kar\u015f\u0131lanana kadar bir i\u015flemi s\u00fcrd\u00fcrmek gibi g\u00f6revler, d\u00f6ng\u00fcler olmadan \u00e7ok daha karma\u015f\u0131k ve hataya a\u00e7\u0131k olurdu.<\/p>\n<h2>While D\u00f6ng\u00fcs\u00fc: Ko\u015ful \u00d6ncesi Kontrol<\/h2>\n<p><code>while<\/code> d\u00f6ng\u00fcs\u00fc, belirli bir ko\u015ful do\u011fru (<code>true<\/code>) oldu\u011fu s\u00fcrece bir kod blo\u011funu tekrar tekrar \u00e7al\u0131\u015ft\u0131ran bir yap\u0131d\u0131r. Bu d\u00f6ng\u00fc, &#8220;\u00f6n ko\u015fullu d\u00f6ng\u00fc&#8221; olarak da bilinir, \u00e7\u00fcnk\u00fc d\u00f6ng\u00fcye ba\u015flamadan \u00f6nce ko\u015ful kontrol edilir. E\u011fer ko\u015ful ba\u015flang\u0131\u00e7ta yanl\u0131\u015f (<code>false<\/code>) ise, d\u00f6ng\u00fcn\u00fcn i\u00e7indeki kod blo\u011fu hi\u00e7bir zaman \u00e7al\u0131\u015fmayabilir.<\/p>\n<h3>While D\u00f6ng\u00fcs\u00fcn\u00fcn S\u00f6zdizimi<\/h3>\n<pre><code class=\"language-javascript\">\n    while (ko\u015ful) {\n        \/\/ Ko\u015ful do\u011fru oldu\u011fu s\u00fcrece \u00e7al\u0131\u015facak kod\n        \/\/ (D\u00f6ng\u00fc ko\u015fulunu bir noktada yanl\u0131\u015f yapacak bir ifade olmal\u0131)\n    }\n    <\/code><\/pre>\n<h3>While D\u00f6ng\u00fcs\u00fc Nas\u0131l \u00c7al\u0131\u015f\u0131r?<\/h3>\n<ol>\n<li>D\u00f6ng\u00fcye ba\u015flamadan \u00f6nce <code>(ko\u015ful)<\/code> ifadesi de\u011ferlendirilir.<\/li>\n<li>E\u011fer ko\u015ful <code>true<\/code> ise, d\u00f6ng\u00fcn\u00fcn s\u00fcsl\u00fc parantezleri <code>{}<\/code> i\u00e7indeki kod blo\u011fu \u00e7al\u0131\u015ft\u0131r\u0131l\u0131r.<\/li>\n<li>Kod blo\u011fu \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131ktan sonra, ko\u015ful tekrar de\u011ferlendirilir.<\/li>\n<li>Bu s\u00fcre\u00e7, ko\u015ful <code>false<\/code> olana kadar devam eder.<\/li>\n<li>Ko\u015ful <code>false<\/code> oldu\u011funda, d\u00f6ng\u00fc sona erer ve program d\u00f6ng\u00fcden sonraki ilk kod sat\u0131r\u0131ndan devam eder.<\/li>\n<\/ol>\n<h3>While D\u00f6ng\u00fcs\u00fc \u00d6rnekleri<\/h3>\n<h4>\u00d6rnek 1: Basit Bir Saya\u00e7<\/h4>\n<p>Bu \u00f6rnekte, <code>sayac<\/code> de\u011fi\u015fkeni 5&#8217;ten k\u00fc\u00e7\u00fck oldu\u011fu s\u00fcrece konsola de\u011ferini yazd\u0131r\u0131yoruz ve her iterasyonda <code>sayac<\/code>&#8216;\u0131 bir art\u0131r\u0131yoruz. Bu art\u0131rma i\u015flemi, d\u00f6ng\u00fcn\u00fcn bir noktada sona ermesini sa\u011flar.<\/p>\n<pre><code class=\"language-javascript\">\n    let sayac = 0;\n\n    while (sayac < 5) {\n        console.log(\"Say\u0131: \" + sayac);\n        sayac++; \/\/ Bu ifade olmazsa sonsuz d\u00f6ng\u00fc olu\u015fur!\n    }\n    \/\/ \u00c7\u0131kt\u0131:\n    \/\/ Say\u0131: 0\n    \/\/ Say\u0131: 1\n    \/\/ Say\u0131: 2\n    \/\/ Say\u0131: 3\n    \/\/ Say\u0131: 4\n    <\/code><\/pre>\n<h4>\u00d6rnek 2: Kullan\u0131c\u0131dan Ge\u00e7erli Girdi Alma<\/h4>\n<p>Kullan\u0131c\u0131dan belirli bir girdi al\u0131nana kadar tekrar tekrar sormak gibi durumlarda <code>while<\/code> d\u00f6ng\u00fcs\u00fc olduk\u00e7a kullan\u0131\u015fl\u0131d\u0131r.<\/p>\n<pre><code class=\"language-javascript\">\n    let kullaniciCevabi = \"\";\n\n    while (kullaniciCevabi !== \"evet\" && kullaniciCevabi !== \"hay\u0131r\") {\n        kullaniciCevabi = prompt(\"L\u00fctfen 'evet' veya 'hay\u0131r' yaz\u0131n:\").toLowerCase();\n        if (kullaniciCevabi !== \"evet\" && kullaniciCevabi !== \"hay\u0131r\") {\n            alert(\"Ge\u00e7ersiz giri\u015f. L\u00fctfen tekrar deneyin.\");\n        }\n    }\n    console.log(\"Cevab\u0131n\u0131z: \" + kullaniciCevabi);\n    <\/code><\/pre>\n<h3>Pratik Bilgi: Sonsuz D\u00f6ng\u00fclerden Ka\u00e7\u0131nma<\/h3>\n<p><code>while<\/code> d\u00f6ng\u00fclerinde en yayg\u0131n hatalardan biri, d\u00f6ng\u00fc ko\u015fulunun hi\u00e7bir zaman <code>false<\/code> olmamas\u0131 durumunda ortaya \u00e7\u0131kan \"sonsuz d\u00f6ng\u00fcd\u00fcr\". Bir sonsuz d\u00f6ng\u00fc, program\u0131n\u0131z\u0131n tak\u0131lmas\u0131na ve yan\u0131t vermemesine neden olur. Bunu \u00f6nlemek i\u00e7in, d\u00f6ng\u00fc ko\u015fulunu bir noktada yanl\u0131\u015f yapacak bir ifadeyi (genellikle bir de\u011fi\u015fkenin g\u00fcncellenmesi) d\u00f6ng\u00fc blo\u011funun i\u00e7ine ekledi\u011finizden emin olun.<\/p>\n<h2>Do...While D\u00f6ng\u00fcs\u00fc: Ko\u015ful Sonras\u0131 Kontrol<\/h2>\n<p><code>do...while<\/code> d\u00f6ng\u00fcs\u00fc de bir ko\u015ful do\u011fru oldu\u011fu s\u00fcrece bir kod blo\u011funu \u00e7al\u0131\u015ft\u0131r\u0131r, ancak \u00f6nemli bir fark\u0131 vard\u0131r: kod blo\u011fu <em>en az bir kez<\/em> \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131ktan sonra ko\u015ful kontrol edilir. Bu nedenle, <code>do...while<\/code> d\u00f6ng\u00fcleri \"son ko\u015fullu d\u00f6ng\u00fc\" olarak adland\u0131r\u0131l\u0131r. Ko\u015ful ba\u015flang\u0131\u00e7ta yanl\u0131\u015f olsa bile, d\u00f6ng\u00fcn\u00fcn i\u00e7indeki kod blo\u011fu mutlaka bir kez \u00e7al\u0131\u015facakt\u0131r.<\/p>\n<h3>Do...While D\u00f6ng\u00fcs\u00fcn\u00fcn S\u00f6zdizimi<\/h3>\n<pre><code class=\"language-javascript\">\n    do {\n        \/\/ En az bir kez \u00e7al\u0131\u015facak kod\n        \/\/ (D\u00f6ng\u00fc ko\u015fulunu bir noktada yanl\u0131\u015f yapacak bir ifade olmal\u0131)\n    } while (ko\u015ful); \/\/ Ko\u015ful do\u011fru oldu\u011fu s\u00fcrece tekrar \u00e7al\u0131\u015f\u0131r\n    <\/code><\/pre>\n<h3>Do...While D\u00f6ng\u00fcs\u00fc Nas\u0131l \u00c7al\u0131\u015f\u0131r?<\/h3>\n<ol>\n<li>\u00d6nce <code>do<\/code> blo\u011fundaki kod \u00e7al\u0131\u015ft\u0131r\u0131l\u0131r.<\/li>\n<li>Kod blo\u011fu \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131ktan sonra, <code>while (ko\u015ful)<\/code> ifadesi de\u011ferlendirilir.<\/li>\n<li>E\u011fer ko\u015ful <code>true<\/code> ise, d\u00f6ng\u00fc tekrar eder ve <code>do<\/code> blo\u011fu bir kez daha \u00e7al\u0131\u015ft\u0131r\u0131l\u0131r.<\/li>\n<li>Bu s\u00fcre\u00e7, ko\u015ful <code>false<\/code> olana kadar devam eder.<\/li>\n<li>Ko\u015ful <code>false<\/code> oldu\u011funda, d\u00f6ng\u00fc sona erer.<\/li>\n<\/ol>\n<h3>Do...While D\u00f6ng\u00fcs\u00fc \u00d6rnekleri<\/h3>\n<h4>\u00d6rnek 1: Basit Bir Saya\u00e7<\/h4>\n<p><code>while<\/code> d\u00f6ng\u00fcs\u00fcyle ayn\u0131 sayac\u0131 <code>do...while<\/code> ile de yapabiliriz. Ancak burada <code>i=0<\/code> iken bile kod blo\u011fu bir kez \u00e7al\u0131\u015f\u0131r, sonra <code>i < 5<\/code> ko\u015fulu kontrol edilir.<\/p>\n<pre><code class=\"language-javascript\">\n    let i = 0;\n\n    do {\n        console.log(\"Say\u0131: \" + i);\n        i++;\n    } while (i < 5);\n    \/\/ \u00c7\u0131kt\u0131:\n    \/\/ Say\u0131: 0\n    \/\/ Say\u0131: 1\n    \/\/ Say\u0131: 2\n    \/\/ Say\u0131: 3\n    \/\/ Say\u0131: 4\n    <\/code><\/pre>\n<h4>\u00d6rnek 2: Minimum Bir Kez \u00c7al\u0131\u015fmas\u0131 Gereken Durum (Men\u00fc Sistemi)<\/h4>\n<p>Bir kullan\u0131c\u0131ya men\u00fc se\u00e7enekleri sunup ge\u00e7erli bir se\u00e7im yapana kadar tekrar sormak gibi durumlarda <code>do...while<\/code> d\u00f6ng\u00fcs\u00fc idealdir, \u00e7\u00fcnk\u00fc men\u00fcy\u00fc kullan\u0131c\u0131ya en az bir kez g\u00f6stermeniz gerekir.<\/p>\n<pre><code class=\"language-javascript\">\n    let secim;\n\n    do {\n        secim = prompt(\"L\u00fctfen bir i\u015flem se\u00e7in:\\n1. Bakiye Sorgulama\\n2. Para Yat\u0131rma\\n3. Para \u00c7ekme\\n4. \u00c7\u0131k\u0131\u015f\");\n        switch (secim) {\n            case \"1\":\n                console.log(\"Bakiyeniz: XXX TL\");\n                break;\n            case \"2\":\n                console.log(\"Para yat\u0131rma i\u015flemi...\");\n                break;\n            case \"3\":\n                console.log(\"Para \u00e7ekme i\u015flemi...\");\n                break;\n            case \"4\":\n                console.log(\"\u00c7\u0131k\u0131\u015f yap\u0131l\u0131yor...\");\n                break;\n            default:\n                alert(\"Ge\u00e7ersiz se\u00e7im. L\u00fctfen 1-4 aras\u0131nda bir say\u0131 girin.\");\n        }\n    } while (secim !== \"4\");\n    console.log(\"\u0130\u015flem tamamland\u0131.\");\n    <\/code><\/pre>\n<h2>While ve Do...While D\u00f6ng\u00fclerinin Kar\u015f\u0131la\u015ft\u0131rmas\u0131 ve Ne Zaman Hangisini Kullanmal\u0131?<\/h2>\n<p>\u0130ki d\u00f6ng\u00fc aras\u0131ndaki temel fark, ko\u015ful kontrol\u00fcn\u00fcn ne zaman yap\u0131ld\u0131\u011f\u0131d\u0131r. Bu fark, hangi d\u00f6ng\u00fcn\u00fcn belirli bir senaryo i\u00e7in daha uygun oldu\u011funu belirler.<\/p>\n<h3>Temel Farklar<\/h3>\n<ul>\n<li><strong><code>while<\/code> d\u00f6ng\u00fcs\u00fc:<\/strong> Ko\u015ful d\u00f6ng\u00fcye girmeden \u00f6nce kontrol edilir. E\u011fer ko\u015ful ba\u015flang\u0131\u00e7ta <code>false<\/code> ise, d\u00f6ng\u00fc blo\u011fu <em>hi\u00e7bir zaman<\/em> \u00e7al\u0131\u015fmayabilir.<\/li>\n<li><strong><code>do...while<\/code> d\u00f6ng\u00fcs\u00fc:<\/strong> Kod blo\u011fu en az bir kez \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131ktan sonra ko\u015ful kontrol edilir. Bu nedenle, d\u00f6ng\u00fc blo\u011fu <em>mutlaka en az bir kez<\/em> \u00e7al\u0131\u015f\u0131r.<\/li>\n<\/ul>\n<h3>Ne Zaman <code>while<\/code> Kullanmal\u0131?<\/h3>\n<ul>\n<li>D\u00f6ng\u00fcn\u00fcn hi\u00e7 \u00e7al\u0131\u015fmama ihtimali varsa.<\/li>\n<li>D\u00f6ng\u00fcye ba\u015flamadan \u00f6nce bir ko\u015fulun sa\u011flanmas\u0131 gerekiyorsa.<\/li>\n<li>\u0130terasyon say\u0131s\u0131 \u00f6nceden belli de\u011filse ve bir ko\u015fulun kar\u015f\u0131lanmas\u0131na ba\u011fl\u0131 olarak d\u00f6ng\u00fcn\u00fcn devam etmesi gerekiyorsa (\u00f6rne\u011fin, dosya sonuna ula\u015fana kadar okuma).<\/li>\n<\/ul>\n<h3>Ne Zaman <code>do...while<\/code> Kullanmal\u0131?<\/h3>\n<ul>\n<li>D\u00f6ng\u00fcdeki kodun en az bir kez \u00e7al\u0131\u015fmas\u0131n\u0131 garanti etmeniz gerekiyorsa.<\/li>\n<li>\u00d6zellikle kullan\u0131c\u0131dan girdi al\u0131rken ve bu girdinin ge\u00e7erlili\u011fini kontrol ederken (kullan\u0131c\u0131ya mutlaka bir kez sorman\u0131z gerekir).<\/li>\n<li>Men\u00fc sistemleri veya ilk \u00e7al\u0131\u015ft\u0131rmada bir kaynak y\u00fcklemeniz\/bir durumu ba\u015flatman\u0131z gereken durumlar.<\/li>\n<\/ul>\n<h2>D\u00f6ng\u00fc Kontrol Deyimleri: <code>break<\/code> ve <code>continue<\/code><\/h2>\n<p><code>while<\/code> ve <code>do...while<\/code> d\u00f6ng\u00fclerinin davran\u0131\u015f\u0131n\u0131 daha esnek bir \u015fekilde kontrol etmek i\u00e7in <code>break<\/code> ve <code>continue<\/code> anahtar kelimelerini kullanabiliriz.<\/p>\n<h3><code>break<\/code> Deyimi<\/h3>\n<p><code>break<\/code> deyimi, i\u00e7inde bulundu\u011fu d\u00f6ng\u00fcy\u00fc tamamen sonland\u0131rmak ve d\u00f6ng\u00fcden hemen \u00e7\u0131kmak i\u00e7in kullan\u0131l\u0131r. D\u00f6ng\u00fcden \u00e7\u0131kt\u0131ktan sonra program, d\u00f6ng\u00fcden sonraki ilk kod sat\u0131r\u0131ndan devam eder.<\/p>\n<pre><code class=\"language-javascript\">\n    let sayi = 0;\n    while (true) { \/\/ Bu sonsuz bir d\u00f6ng\u00fc gibi g\u00f6r\u00fcn\u00fcr, ama break ile kontrol edilir\n        console.log(\"Say\u0131: \" + sayi);\n        sayi++;\n        if (sayi === 5) {\n            break; \/\/ Say\u0131 5 olunca d\u00f6ng\u00fcy\u00fc k\u0131r\n        }\n    }\n    console.log(\"D\u00f6ng\u00fc break ile sonland\u0131r\u0131ld\u0131.\");\n    \/\/ \u00c7\u0131kt\u0131:\n    \/\/ Say\u0131: 0\n    \/\/ Say\u0131: 1\n    \/\/ Say\u0131: 2\n    \/\/ Say\u0131: 3\n    \/\/ Say\u0131: 4\n    \/\/ D\u00f6ng\u00fc break ile sonland\u0131r\u0131ld\u0131.\n    <\/code><\/pre>\n<h3><code>continue<\/code> Deyimi<\/h3>\n<p><code>continue<\/code> deyimi, d\u00f6ng\u00fcn\u00fcn mevcut iterasyonunu atlamak ve bir sonraki iterasyona ge\u00e7mek i\u00e7in kullan\u0131l\u0131r. <code>continue<\/code> kar\u015f\u0131la\u015f\u0131ld\u0131\u011f\u0131nda, d\u00f6ng\u00fc blo\u011funun kalan k\u0131sm\u0131 atlan\u0131r ve d\u00f6ng\u00fc ko\u015fulu tekrar kontrol edilerek bir sonraki iterasyona ge\u00e7ilir (e\u011fer ko\u015ful hala do\u011fruysa).<\/p>\n<pre><code class=\"language-javascript\">\n    let j = 0;\n    while (j < 10) {\n        j++;\n        if (j % 2 === 0) { \/\/ E\u011fer say\u0131 \u00e7iftse, bu iterasyonu atla\n            continue;\n        }\n        console.log(\"Tek say\u0131: \" + j);\n    }\n    \/\/ \u00c7\u0131kt\u0131:\n    \/\/ Tek say\u0131: 1\n    \/\/ Tek say\u0131: 3\n    \/\/ Tek say\u0131: 5\n    \/\/ Tek say\u0131: 7\n    \/\/ Tek say\u0131: 9\n    <\/code><\/pre>\n<h2>Sonu\u00e7 ve S\u0131k\u00e7a Sorulan Sorular (SSS)<\/h2>\n<p><code>while<\/code> ve <code>do...while<\/code> d\u00f6ng\u00fcleri, JavaScript'te tekrarlayan g\u00f6revleri y\u00f6netmek i\u00e7in g\u00fc\u00e7l\u00fc ve esnek ara\u00e7lard\u0131r. Temel farklar\u0131, ko\u015fulun d\u00f6ng\u00fcye girmeden \u00f6nce mi yoksa en az bir kez \u00e7al\u0131\u015ft\u0131ktan sonra m\u0131 kontrol edildi\u011fidir. Bu fark\u0131 anlamak, do\u011fru d\u00f6ng\u00fc yap\u0131s\u0131n\u0131 se\u00e7erek daha sa\u011flam ve verimli kod yazman\u0131za yard\u0131mc\u0131 olacakt\u0131r. <code>break<\/code> ve <code>continue<\/code> deyimleri ise d\u00f6ng\u00fc ak\u0131\u015f\u0131n\u0131 daha da hassas bir \u015fekilde kontrol etmenizi sa\u011flar.<\/p>\n<h3>S\u0131k\u00e7a Sorulan Sorular (SSS)<\/h3>\n<h4>S: Sonsuz d\u00f6ng\u00fc nedir ve nas\u0131l \u00f6nlenir?<\/h4>\n<p>C: Sonsuz d\u00f6ng\u00fc, d\u00f6ng\u00fc ko\u015fulunun hi\u00e7bir zaman <code>false<\/code> olmayacak \u015fekilde ayarland\u0131\u011f\u0131 bir d\u00f6ng\u00fcd\u00fcr. Bu, program\u0131n\u0131z\u0131n tak\u0131lmas\u0131na neden olur. \u00d6nlemek i\u00e7in, d\u00f6ng\u00fc blo\u011fu i\u00e7inde d\u00f6ng\u00fc ko\u015fulunu bir noktada yanl\u0131\u015f yapacak bir ifade (\u00f6rne\u011fin, bir sayac\u0131 art\u0131rma veya bir boolean bayra\u011f\u0131 de\u011fi\u015ftirme) bulundurdu\u011funuzdan emin olun.<\/p>\n<h4>S: <code>while<\/code> ve <code>do...while<\/code> aras\u0131ndaki temel fark nedir?<\/h4>\n<p>C: Temel fark, ko\u015fulun kontrol edilme zaman\u0131d\u0131r. <code>while<\/code> d\u00f6ng\u00fcs\u00fc ko\u015fulu ba\u015fta kontrol eder; bu y\u00fczden d\u00f6ng\u00fc hi\u00e7 \u00e7al\u0131\u015fmayabilir. <code>do...while<\/code> d\u00f6ng\u00fcs\u00fc ise kodu en az bir kez \u00e7al\u0131\u015ft\u0131rd\u0131ktan sonra ko\u015fulu kontrol eder, bu da kod blo\u011funun mutlaka bir kez \u00e7al\u0131\u015fmas\u0131n\u0131 garanti eder.<\/p>\n<h4>S: Hangi d\u00f6ng\u00fcy\u00fc ne zaman kullanmal\u0131y\u0131m?<\/h4>\n<p>C: D\u00f6ng\u00fcn\u00fcn hi\u00e7 \u00e7al\u0131\u015fmama ihtimali varsa veya d\u00f6ng\u00fcye ba\u015flamadan \u00f6nce bir ko\u015fulun sa\u011flanmas\u0131 gerekiyorsa <code>while<\/code> d\u00f6ng\u00fcs\u00fcn\u00fc tercih edin. D\u00f6ng\u00fcdeki kodun en az bir kez \u00e7al\u0131\u015fmas\u0131n\u0131 garanti etmeniz gerekiyorsa (\u00f6rne\u011fin, kullan\u0131c\u0131dan ge\u00e7erli bir girdi al\u0131nana kadar tekrar sormak gibi), <code>do...while<\/code> d\u00f6ng\u00fcs\u00fcn\u00fc kullan\u0131n.<\/p>\n<h4>S: <code>break<\/code> ve <code>continue<\/code> ne i\u015fe yarar?<\/h4>\n<p>C: <code>break<\/code> deyimi, i\u00e7inde bulundu\u011fu d\u00f6ng\u00fcy\u00fc tamamen sonland\u0131r\u0131r ve program\u0131 d\u00f6ng\u00fcden \u00e7\u0131kar\u0131r. <code>continue<\/code> deyimi ise d\u00f6ng\u00fcn\u00fcn mevcut iterasyonunu atlar ve bir sonraki iterasyona ge\u00e7ilmesini sa\u011flar.<\/p>\n<h4>S: <code>for<\/code> d\u00f6ng\u00fcs\u00fc yerine <code>while<\/code> ne zaman tercih edilir?<\/h4>\n<p>C: E\u011fer iterasyon say\u0131s\u0131 \u00f6nceden kesin olarak biliniyorsa (\u00f6rne\u011fin bir dizideki eleman say\u0131s\u0131 kadar d\u00f6nmek), genellikle <code>for<\/code> d\u00f6ng\u00fcs\u00fc daha okunabilir ve uygundur. Ancak, iterasyon say\u0131s\u0131 \u00f6nceden bilinmedi\u011finde veya bir ko\u015fulun kar\u015f\u0131lanmas\u0131na ba\u011fl\u0131 olarak d\u00f6ng\u00fcn\u00fcn devam etmesi gerekti\u011finde (\u00f6rne\u011fin, kullan\u0131c\u0131 \"\u00e7\u0131k\u0131\u015f\" yazana kadar), <code>while<\/code> d\u00f6ng\u00fcs\u00fc daha uygun bir se\u00e7enektir.<\/p>\n<p>    <\/body><\/p>\n","protected":false},"excerpt":{"rendered":"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131\n    Programlamada belirli bir kod blo\u011funu birden fazla kez \u00e7al\u0131\u015ft","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[129],"tags":[],"class_list":{"0":"post-39827","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-javascript","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JavaScript&#039;te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131 - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript&#039;te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131\" \/>\n<meta property=\"og:description\" content=\"JavaScript&#039;te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131   Programlamada belirli bir kod blo\u011funu birden fazla kez \u00e7al\u0131\u015ft\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-24T08:41:18+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131\",\"datePublished\":\"2026-02-24T08:41:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\"},\"wordCount\":1527,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Javascript\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#respond\"]}],\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\",\"name\":\"JavaScript'te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131 - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2026-02-24T08:41:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript'te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131 - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/","og_locale":"tr_TR","og_type":"article","og_title":"JavaScript'te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131","og_description":"JavaScript'te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131   Programlamada belirli bir kod blo\u011funu birden fazla kez \u00e7al\u0131\u015ft","og_url":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2026-02-24T08:41:18+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"9 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131","datePublished":"2026-02-24T08:41:18+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/"},"wordCount":1527,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Javascript"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#respond"]}],"copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/","url":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/","name":"JavaScript'te While ve Do...While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131 - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2026-02-24T08:41:18+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/javascriptte-while-ve-do-while-donguleri-temel-tekrarlama-yapilari\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript&#8217;te While ve Do&#8230;While D\u00f6ng\u00fcleri: Temel Tekrarlama Yap\u0131lar\u0131"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=39827"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39827\/revisions"}],"predecessor-version":[{"id":39828,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/39827\/revisions\/39828"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=39827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=39827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=39827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}