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

Code Example 1

loop do
  puts Time.now
  sleep(5)        # 5 second sleep 
end

Code Example 2

loop do
  puts "infinite"
end

Learn ReactJs, React Native from akashmittal.com