I understand that you can use the sleep(2) which pause x time before the code displays but I want it to execute and display codes line by line. Eg:
x = 1
y = 2
puts x + y #I want this line to show first
sleep(5) #Above line shows but waiting 5 seconds before showing below
puts x + y * 2 #After 5 seconds this line shows
sleep(10) #After 10 seconds etc
puts (x + y) * 2
This works great in C programming but not Ruby.