Ana sayfa Genel Ruby Başlangıç Rehberi (Yorum satırları, değişken tanımlama,print ve puts fonksiyonu)

Ruby Başlangıç Rehberi (Yorum satırları, değişken tanımlama,print ve puts fonksiyonu)


Ruby nesne tabanlı modern bir programlama dilidir. Yapısı gereği fonksiyonel programlama işlemlerini de kolayca gerçekleştirebilir. Ruby’nin hikayesine arzu ederseniz aşağıdaki adresten ulaşabilirsiniz.

Programın çalışması için kullandığınız sisteme göre indirmeniz gerekenleri ise şuraya bırakıyorum.

Rahat bir kullanımı olan Visual Studio Code editörünün linkini de şuraya koyuvereyim.

Kodları çalıştırmak için .rb uzantılı bir dosya oluşturup, yazdıklarınızı terminalden çalıştırabilirsiniz.

View > Integrated Terminal sekmesinden, DEBUG CONSOLE‘un yanındaki TERMINAL‘e ulaşmalısınız.

Yazılan kodları kaydettikten sonra, terminale ” ruby dosya_ismi.rb ” şeklinde bir komut yazarak kodunuzu rahatlıkla çalıştırabilirsiniz.”

Konsolu temizlemek için ” ctrl + k ” sekmesini kullanabilirsiniz.

Öncelikle Ruby programlama diline “yorum satırları” ile giriş yapmak istiyorum. Tüm programcıların bildiği gibi yorum satırları, daha sonra olası geliştirme için muazzam bir öneme sahiptir. Eğer algoritmanız kompleks bir yapıya sahipse olası karışıkları bu şekilde önleyebilirsiniz.

Yorum satırlarını aşağıdaki basit Syntax ile oluşturabilirsiniz.

Bir sonraki değineceğimiz konu ise, değişken tanımlama kavramı. Daha önce programlama geçmişi olanların aşina olacağı ve programlamada birincil öneme sahip olan değişken tanımlama kavramını, bilmeyenler için kısaca değinmek gerekirse.

Çeşitli işlemleri yapmak için programlayıcıdan veya kullanıcıdan alınan bilginin sembolik bir değişken ile temsil edilme olayına, değişken tanımlama denir.

Sonuçları veya göstermek istediklerimizi de iki şekilde yazabiliriz.

print yazılacak_veri  yazım şekli art arda yazılan yazıyı alt alta değil de yan yana yazar. Örnek olarak:

puts yazılacak_veri fonksiyonu ise, art arda yazılan verileri direkt alt alta yazar.

Değişken tanımlama olayını anladığımıza göre artık değişkenler arası tür dönüşümünün nasıl yapıldığına bakabiliriz.

Bunun için genel bir tanım yapacak olursak

yeni_degisken = eski_degisken.to_i 

burada veriyi Integer‘e çevirdik, oysa Float veya String  veri tipine de dönüştürebiliriz.

Bunun için:

.to_f (Float’a dönüştürmek için)

.to_s (String’e dönüştürmek için)

Bir veriyi (Mesela bir Integer yani tam sayı değerini, float yani ondalıklı sayıya dönüştürmeye çalışalım.)


Şimdilik bu kadar, yeni bir yazımızda görüşmek üzere ! 🙂


  1. Wow, marvelous blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your web site is great, as well as the content!

  2. I’ve been exploring for a little bit for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this site. Reading this info So i’m happy to convey that I’ve an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make sure to don’t forget this site and give it a glance on a constant basis.

  3. Enjoyed reading this, very good stuff, appreciate it. “We swallow greedily any lie that flatters us, but we sip little by little at a truth we find bitter.” by Denis Diderot.

  4. That is really fascinating, You are an overly professional blogger. I’ve joined your rss feed and sit up for in quest of more of your excellent post. Also, I have shared your website in my social networks!

  5. 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.

  6. I am not sure where you’re getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for wonderful information I was looking for this information for my mission.

  7. You could certainly see your expertise in the work you write. The world hopes for more passionate writers like you who are not afraid to say how they believe. Always go after your heart.

  8. I actually wanted to make a small remark to be able to express gratitude to you for all the wonderful advice you are showing on this website. My time-consuming internet research has finally been compensated with extremely good details to exchange with my family. I ‘d point out that many of us visitors actually are undeniably blessed to dwell in a really good site with very many awesome professionals with interesting methods. I feel very much happy to have used your website and look forward to really more brilliant minutes reading here. Thanks a lot once again for everything.

  9. Great goods from you, man. I have take note your stuff previous to and you are just too great.
    I really like what you’ve received here, really like what you’re stating and the best way by which you are saying
    it. You’re making it enjoyable and you still care for to keep it wise.
    I can’t wait to learn much more from you. This is really a wonderful website.

  10. With havin so much content and articles do you ever run into any issues
    of plagorism or copyright infringement? My site has a lot of completely unique content I’ve either authored myself or outsourced but it seems a lot of it is popping
    it up all over the web without my agreement.
    Do you know any solutions to help reduce content
    from being stolen? I’d truly appreciate it.

  11. Pretty component to content. I just stumbled upon your website and in accession capital to claim that I acquire in fact loved account your blog posts. Any way I will be subscribing to your feeds and even I success you get right of entry to persistently quickly.

  12. Oh my goodness! a tremendous article dude. Thanks However I’m experiencing problem with ur rss . Don’t know why Unable to subscribe to it. Is there anybody getting an identical rss drawback? Anyone who knows kindly respond. Thnkx

  13. Greetings I am so happy I found your weblog, I really found you by accident, while I was looking on Askjeeve for something else, Anyhow I am here now and would just like to say kudos for a marvelous 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 book-marked it and also added in your RSS feeds, so when I have time I will be back to read much more, Please do keep up the great job.

  14. A person essentially help to make seriously articles 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 extraordinary. Wonderful job!

  15. Hi! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?

  16. 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.

  17. I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You are amazing! Thanks!

  18. of course like your website but you have to check the spelling on several of your posts. Many of them are rife with spelling issues and I find it very troublesome to tell the truth nevertheless I will surely come back again.

  19. I like what you guys are up also. Such intelligent work and reporting! Keep up the superb works guys I have incorporated you guys to my blogroll. I think it will improve the value of my website 🙂

  20. Hey I am so excited I found your web site, I really found you
    by accident, while I was researching on Google for something else, Regardless
    I am here now and would just like to say thanks for a tremendous post and a all round entertaining blog (I
    also love the theme/design), I don’t have time to browse it all at the moment but I have
    saved it and also included your RSS feeds,
    so when I have time I will be back to read much more, Please do keep up the awesome job.

  21. Hello! This post couldn’t be written any better! Reading this post reminds me of my previous room mate! He always kept chatting about this. I will forward this page to him. Fairly certain he will have a good read. Many thanks for sharing!

  22. There are actually numerous particulars like that to take into consideration. That may be a nice level to convey up. I offer the thoughts above as general inspiration however clearly there are questions just like the one you deliver up the place crucial thing might be working in sincere good faith. I don?t know if greatest practices have emerged round issues like that, but I’m certain that your job is clearly recognized as a good game. Both girls and boys really feel the impact of only a second’s pleasure, for the rest of their lives.


Lütfen yorumunuzu giriniz
Buraya isminizi giriniz