in this lecture we will see how to comment in troubie so remember comments are very important when it comes to a programming language or when you are writing some programs so they are used to tell you what something does in English and they are also use it to dessert you know disabled parts of your program if you need to remove them temporarily and also you wrote a goal and next time on the same code next other developer are some of your friend or colleague they have to work then how they will understand easily unless you you know you write something in you know our native language or English saying that this is this code this code snippet is you doing this part and the next snippet is doing you know this particular function so we have to give an easy overview with comments so when it comes to Ruby you will see how can we do this so I’m inside my Ruby directory I don’t have any files except my sample Ruby which we created in previous lectures so instead of creating a new file let me show this demonstration on by using IRB i abase nothing but interactive Ruby so if i go here so let’s see if i comment puts I think you already know what is puts puts is used to print something onto the console so this is to display if you see we already got the output so now what I will do I will use the hash it is also called as pond so i’ll do i’ll use that for example so see here use hash and I come up is the same thing here so here if you see we did not see anything so if you want to you know come into multiple lines so we can do that so if you don’t even have to use the puts like example or 91 92 93 so we can write any number of lines with the symbol hash a pawn and also we will have another use cases okay if you have one or two lines we will use hash that is very easy fine if you have to comment some thousand lines of code then how can we do that we can’t put our we can’t upend every line with hash so in such situations we have to use something called begin so let me see whether it will work or not let me give line one line to go sorry ale and one black one so on line thousand so next I will do and so if you see from here to here it took it as comments if you see here from begin from equal begin to equal in it took it as comments and then whatever to write for example what happens if you won’t mention begin end our hash I’ll simply write line one so which it means the Ruby will try to you know interpret or understand what is the meaning of line one if you make our way if you keep this in between the begin and in our if you keep after the hash then it will consider it as comment and then then it won’t try to interpret and it will just you know skip that part so this is how we will use commenting in a draw a

Tags:






Youtube
Facebook
Google Plus
Twitter
TutorialDrive


Apache Zookeeper Tutorial

Apache Kafka Tutorial

Apache Kafka Security

Elasticserarch n Kibana

Java 8 Tutorial

Log4J Tutorial

Apache Storm Tutorial

SQLite Tutorial

Apache Ant Tutorial

Related Posts

blog

Apache Kafka Commands Cheat sheet

Spread the loveKafka Topics List existing topics bin/kafka-topics.sh –zookeeper localhost:2181 –list Purge a topic bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –config retention.ms=1000 … wait a minute … bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –delete-config retention.ms
Read more…

blog

What is Apache Maven | Apache Maven complete tutorial from scratch pdf

Spread the love In this post you will learn the complete tutorial of Apache Maven build tool What is Maven ? Apache Maven is a software project management and comprehension tool. Based on the concept
Read more…

blog

Practical Guide for Web Development in 2018

Spread the loveWelcome to my practical guide  for web development in 2018 in terms of  technology and career. Before we start I just want to  mention a few things, you don’t need to learn  everything that
Read more…