Ana sayfa Genel Ruby Başlangıç Rehberi (Operatörler)

Ruby Başlangıç Rehberi (Operatörler)

1093
49
PAYLAŞ

Bu yazımızda özel olarak sadece Operatörlere değinmek istiyorum. Bir önceki yazımızda Karşılaştırma ve Mantıksal Operatörlere değinmiştik. Şimdi ise diğer Operatör türlerine değinme sırası !

Aritmetik Operatörler :

Bu Operatörler adından anlaşılacağı gibi basit aritmetik işlemleri yapmak için kullanılan Operatör türüdür.

Örnek vermek gerekirse :


Atama Operatörleri :

Bu Operatörleri örnek ile daha iyi açıklayabilirim.


Ruby’de bit düzeyinde işlem yapan operatörlerde mevcuttur.

Fakat ilk önce, bir sayının istenilen tabana nasıl dönüştürüldüğüne bakalım.

Bunu yapmak oldukça basit !

çevrilecek_sayı.to_s(dönüştürülecek_taban)

Genel formatı ile işlemi kolaylıkla gerçekleştirebiliriz.

.to_s(dönüştürülecek_taban) fonksiyonu belirtilen sayıyı temsil eden bir String’e dönüştürür.

.to_i(Geri_dönüştürülecek_sayının_tabanı) fonksiyonu ile sayıyı tekrardan 10’luk tabana dönüştürebiliriz.

Bit düzeyinde Operatörlere artık geçebiliriz.

Bunlar sırasıyla, 

& (ve) , | (veya) , ^ (XOR), ~ (Değili) Operatörleridir.

Şimdi sıra, bit düzeyinde sağa ve sola kaydırma operatörlerinde !

Gördüğünüz gibi bu operatörler 10’luk tabandaki bir sayının 2’lik tabandaki karşılığını istenilen düzeyde sağa ve sola kaydırılmasını sağlamaktadır.


Son olarak değineceğimiz Operatör ise, defined? Operatörü. Bu Operatör, ifadenin tanımlanıp tanımlanmadığını öğrenmemize yarar.

Daha değinmediğimiz birçok operatör mevcut. Onlara ise yeri geldiğinde değineceğiz. Şimdilik benden bu kadar, yeni bir yazıda görüşmek üzere. 🙂

Kaynaklar :

https://www.tutorialspoint.com/ruby/ruby_operators.htm

https://www.calleerlandsson.com/posts/rubys-bitwise-operators/

PAYLAŞ
Önceki makaleİngilizce Öğrenme Yolları
Uludağ Üniversitesi - Fizik bölümü lisans son sınıf öğrencisiyim. Veri bilimi,Makine öğrenimi ve Kriptoloji ile uğraşıyorum.

49 YORUMLAR

  1. Helpful information. Lucky me I found your website accidentally, and I’m shocked why this coincidence didn’t took place in advance! I bookmarked it.

  2. Great post. I was checking constantly this blog and I am impressed! Very useful info specifically the last part 🙂 I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck.

  3. I do love the manner in which you have framed this specific problem plus it does indeed provide us some fodder for thought. Nonetheless, through what I have witnessed, I just simply trust when other remarks pack on that folks stay on point and not embark upon a tirade involving some other news du jour. All the same, thank you for this fantastic piece and though I can not necessarily go along with it in totality, I value your point of view.

  4. Hello. Let me introduce the writer. Her identify is Janell but she doesn’t like when individuals use her complete title. Louisiana is the only location I’ve been residing in and my dad and mom live nearby. One of my preferred hobbies is dominoes but I haven’t manufactured a dime with it. Invoicing is how he supports his loved ones and he’s doing pretty excellent financially. See what’s new on her site right here: womens online shopping websites

  5. Hello this is kind of of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding experience so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  6. Hey very nice website!! Man .. Beautiful .. Amazing .. I’ll bookmark your web site and take the feeds additionally…I am happy to seek out a lot of useful info right here in the submit, we want develop more strategies in this regard, thanks for sharing. . . . . .

  7. I would like to thank you for the efforts you’ve put in writing this website. I’m hoping the same high-grade site post from you in the upcoming as well. Actually your creative writing skills has encouraged me to get my own website now. Really the blogging is spreading its wings fast. Your write up is a great example of it.

  8. Good V I should certainly pronounce, impressed with your site. I had no trouble navigating through all tabs and related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or anything, website theme . a tones way for your customer to communicate. Excellent task..

  9. I am no longer positive the place you’re getting your info, however good topic. I needs to spend a while learning much more or working out more. Thank you for fantastic info I used to be in search of this information for my mission.

  10. Just wish to say your article is as astounding. The clearness to your post is simply spectacular and that i could suppose you are knowledgeable in this subject. Fine along with your permission allow me to snatch your RSS feed to keep up to date with drawing close post. Thanks one million and please continue the enjoyable work.

  11. Hey there! Someone in my Facebook group shared this site with us so I came to take a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers! Superb blog and superb design.

  12. Hey there! I’m at work surfing around your blog from my new apple iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the outstanding work!

  13. I am just commenting to make you be aware of of the exceptional experience my wife’s girl experienced reading through your site. She figured out too many things, which include how it is like to have an excellent helping mood to make other individuals without problems master a variety of specialized things. You undoubtedly did more than visitors’ expected results. I appreciate you for producing those interesting, healthy, educational and also unique tips on the topic to Ethel.

  14. СТО Кузовщик предлагает Вам недорогой кузовной ремонт и покраску автомобилей в Санкт- Петербурге, Купчино.

    Производим ремонт после ДТП любой сложности. Вам не придётся ездить по разным сервисам – мы делаем комплексный ремонт, и Вы уезжаете от нас на полностью исправном автомобиле.

    Мы отремонтировали уже несколько тысяч машин, фотографии многих ремонтов можно посмотреть на нашем сайте. Для того, чтобы попасть на наш сайт – просто наберите в поиске СТО Кузовщик!

    Оценка повреждений по фото и выезд мастера для окончательной оценки – абсолютно бесплатно по СПб и ни к чему Вас не обязывает! Эвакуация в наш автосервис и дефектовка с разбором поврежденных узлов также бесплатна.
    Также, на сайте действует простой калькулятор ремонта – Вы можете сами предварительно понять объём предстоящих расходов.

    Все необходимые для ремонта запчасти закажем и найдём сами, по хорошим ценам. У нас есть своя авторазборка, поэтому большие скидки Вам обеспечены!

    Индивидуальный, профессиональный и честный подход к каждому случаю и к каждому клиенту, гарантия на все работы от 1 года и более. Мы всегда открыты для каждого, в любой момент ремонта Вы можете приехать, и мастер покажет и объяснит каждый этап ремонта.

    Приглашаем Вас в наш автосервис! У нас ремонт действительно качественно, честно и недорого!

  15. I will immediately grab your rss feed as I can not find your e-mail subscription link or newsletter service. Do you’ve any? Kindly let me know in order that I could subscribe. Thanks.

  16. I have been absent for some time, but now I remember why I used to love this website. Thank you, I will try and check back more often. How frequently you update your website?

  17. Hello, i think that i saw you visited my website so i came to “return the favor”.I am trying to find things to improve my site!I suppose its ok to use some of your ideas!!

  18. I do enjoy the way you have presented this specific matter and it does supply us a lot of fodder for thought. Nevertheless, through just what I have experienced, I just hope when the actual comments stack on that folks stay on issue and not embark upon a soap box regarding the news du jour. Anyway, thank you for this exceptional point and while I can not agree with the idea in totality, I respect your standpoint.

  19. Hi, i think that i saw you visited my web site thus i came to “return the favor”.I’m trying to find things to improve my website!I suppose its ok to use some of your ideas!!

  20. That is the suitable blog for anybody who needs to seek out out about this topic. You notice a lot its almost arduous to argue with you (not that I actually would want…HaHa). You undoubtedly put a brand new spin on a subject thats been written about for years. Great stuff, just great!

  21. Thanks for this great information. Well I wants to know little more about how we can convert any amazon link into affiliate link. Like we have tool for flipkart link but I am unable to find any tool for Amazon. Can you suggest me anyone?

  22. Only a smiling visitant here to share the love (:, btw outstanding style and design. “Make the most of your regrets… . To regret deeply is to live afresh.” by Henry David Thoreau.

  23. I am also writing to make you be aware of what a extraordinary experience our daughter experienced reading through your web site. She learned such a lot of pieces, most notably what it is like to have an awesome giving spirit to have the others really easily know just exactly a number of complicated topics. You actually surpassed readers’ expectations. Thank you for imparting such warm and helpful, trusted, informative and as well as fun tips on the topic to Ethel.

BİR CEVAP BIRAK

Lütfen yorumunuzu giriniz
Buraya isminizi giriniz