Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




RUBY - LOOPS


A loop is a concept where something continues endlessly until it is asked to stop. Just like the sun rises in the east and sets in the west is a loop that continues endlessly.


In Ruby we can use the loop concept to print a block of code multiple times.


There are three ways by which we can define a loop in Ruby :

  1. while loop

  2. for loop

  3. until loop

Example :

Do you remember when your teacher asked you to tell the numbers from 1 to 10, how you have done that?

You would have simply memorized it. But Ruby won't do that.

Ruby would be using a concept of loops to print the numbers from 1 to 10.


Let us see it in the next tutorial.