Ana sayfa Mobil Kotlin’de For Döngüsü

Kotlin’de For Döngüsü


Merhabalar Arkadaşlar,

Bugünkü yazımda sizlere döngü çeşitlerinden biri olan For döngüsünden bahsedeceğim. Hazırsanız haydi başlayalım 🙂

Döngü Nedir ?

Döngüler tüm programlama dillerinde olan temel programcılık kavramlarındandır. Döngüler özellikle tekrar edilen işlemlerde kullanmak oldukça kolaylık sağlamaktadır.

Bizler derslerimizde ;

  • For döngüsü
  • While döngüsü
  • Do while döngüsü

yapılarından bahsedeceğiz. Öncelikle bu yazımızda sadece For döngüsünde bahsedeceğim diğer konulara ise ilerleyen derslerde bakacağız.

For Döngüsü

Tüm programlama dillerinde akla gelen ilk döngülerden bir tanesidir. Kotlin dilinde ise for döngüsü kullanarak belli aralıklarla tekrar edilen işlemleri basit bir şekilde yapabilirsiniz.

Syntax :

For döngüsünde in operatörü kullanılarak döngü kurulur. Döngüdeki x değişkeni, koleksiyona ait herbir değere karşılık gelmektedir. Döngü her döndüğünde koleksiyona ait değerler tek tek değişkene yazdırılır. println() komutu ile bu değerler ekranda gösterilir. Döngüde belirtilen koleksiyon alanına : dizi, liste, range ve string bir değer gelebilir.

For Döngüsü ile ilgili örnekler

1- Ekranda 1’den 10’a kadar olan değerleri yazdırma

range kullanarak döngü 1’den 10’a kadar döneceği belirtildi. x değeri 10 değeri olana kadar döngü içinde dönüp değeri ekranda println() metodu yardımıyla yazdırılır.

Programın ekran çıktısı yukarıdaki gibidir.


2- String bir ifadeyi ekranda alt alta yazdırma işlemi

String türde bir değişken tanımladık. Tanımlanan değişkene bir değer atadık. Atanan değeri for yardımıyla herbir karakterini ekranda gösteriyoruz.

Programın ekran çıktısı yukarıdaki gibidir.


3- Dizinin içerisinde bulunan elemanların toplamı

Array tanımlandı ve değerleri verildi. Dizinin elemanları toplayabilmek için sum değişkeni tanımlandı. Dizinin içinde değerler adım adım toplandı. Döngü dışında ise bu toplam değeri ekranda gösterildi.

Programın ekran çıktısı yukarıdaki gibidir.


Evet arkadaşlar For döngüsünden bahsettiğimiz blog yazısının sonuna geldik. Bir sonraki yazıda görüşmek üzere kendinize iyi bakın. Bol kodlu akşamlar dilerim 🙂



Önceki makaleMachine Learning Öğrenme Rehberi
Sonraki makaleİşletme bölümü nedir?
İstanbul Sabahattin Zaim Üniversitesi Bilgisayar Mühendisliği 4. sınıf öğrencisiyim. Üniversitede Java, C, C++ programlama dillerini öğrendim. Bu diller ile çeşitli uygulamalar geliştirdim. Kullanıcı arayüzü olarak Java'nın Swing API'si üzerinde çalışmalar yaptım. Python ve PHP dillerine giriş yaptım. Siber güvenlik alanına ilgiliyim. Android​ Uygulamalar geliştiriyorum. Kotlin ve Swift dillerini öğreniyorum. Linux işletim sistemini başlangıç seviyesinde biliyorum. Boş zamanlarımda kitap ve mesleki dergi okuyorum. Teknoloji ve bilişim bloglarını takip ediyorum. Medium da blog yazıları yazıyorum. Kariyerime Android Developer ve iOS Developer olarak devam etmek istiyorum.


  1. Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular you express are really awesome. Hope you will right some more posts.

  2. Someone essentially lend a hand to make critically posts I would state. This is the first time I frequented your web page and thus far? I surprised with the research you made to create this particular publish amazing. Fantastic job!

  3. This design is spectacular! You most certainly know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Great job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  4. I’ve been browsing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the internet will be much more useful than ever before.

  5. Simply wish to say your article is as astounding. The clarity on your submit
    is just excellent and that i can think you are knowledgeable in this subject.
    Well with your permission allow me to grasp your RSS feed to stay updated with forthcoming post.

    Thank you one million and please carry on the enjoyable work.

  6. Having read this I thought it was very informative. I appreciate you taking the time and effort
    to put this short article together. I once again find myself spending a
    lot of time both reading and commenting. But so what, it was still
    worth it!

  7. Hello! I could have sworn I’ve been to this blog before but after browsing through some of the post I realized it’s new to me. Anyways, I’m definitely happy I found it and I’ll be book-marking and checking back frequently!

  8. What i don’t realize is actually how you are not actually much more neatly-preferred than you might be now. You’re so intelligent. You recognize therefore considerably when it comes to this topic, made me individually believe it from numerous varied angles. Its like men and women aren’t fascinated except it?¦s one thing to accomplish with Girl gaga! Your individual stuffs excellent. All the time take care of it up!

  9. Hello! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I’m getting fed up of WordPress because I’ve had problems with hackers and I’m looking at options for another platform. I would be great if you could point me in the direction of a good platform.

  10. Hey there I am so happy I found your weblog, I really found you by
    error, while I was browsing on Digg for something else, Anyhow I am here now and
    would just like to say thanks a lot for a tremendous post and a all round exciting blog (I also love the
    theme/design), I don’t have time to read it all at the minute but
    I have bookmarked it and also added your RSS feeds, so when I have time I will be
    back to read a lot more, Please do keep up
    the great work.

  11. You really make it seem really easy along with your presentation but I in finding this topic to be actually one thing that I believe I would by no means understand. It sort of feels too complicated and extremely large for me. I’m having a look forward for your next post, I will attempt to get the hold of it!

  12. A fascinating discussion is definitely worth comment.
    I believe that you ought to write more on this subject, it might not be a taboo matter but usually people do not speak about such topics.
    To the next! Best wishes!!

  13. I think that is among the most vital info for me. And i’m happy studying your article. However should statement on few basic issues, The web site taste is wonderful, the articles is really excellent : D. Good job, cheers

  14. We’re a group of volunteers and starting a new scheme in our community. Your site provided us with valuable information to work on. You have done an impressive job and our whole community will be grateful to you.

  15. Very interesting subject, appreciate it for putting up. “All human beings should try to learn before they die what they are running from, and to, and why.” by James Thurber.

  16. Very well written story. It will be valuable to everyone who employess it, including me. Keep doing what you are doing – for sure i will check out more posts.

  17. You actually make it appear so easy along with your presentation but I find this topic to be actually one thing that I feel I’d never understand. It kind of feels too complicated and very extensive for me. I am taking a look forward to your next submit, I?¦ll try to get the dangle of it!

  18. Simply want to say your article is as amazing. The clarity in your post is simply excellent and i can assume you’re an expert on this subject. Fine with your permission let me to grab your feed to keep up to date with forthcoming post. Thanks a million and please keep up the enjoyable work.

  19. I would like to thnkx for the efforts you have put in writing this blog. I am hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has inspired me to get my own blog now. Really the blogging is spreading its wings quickly. Your write up is a good example of it.


Lütfen yorumunuzu giriniz
Buraya isminizi giriniz