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

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com