Check out example codes for "ruby while". It will help you in understanding the concepts better.

Code Example 1

a = ["One", "Two", "Three", "Four"];
b = 0
while b<a.length do
  puts a[b]
  b+=1
end

Code Example 2

while $i < $num  do
   puts("Inside the loop i = #$i" )
   $i +=1
end

Learn ReactJs, React Native from akashmittal.com