Simple Way to learn Each do iteration for ruby.
If you already started coding and already used a while loop then this has the same concept but it goes through a collection of data like arrays or hashes. The iteration will go on each one of the data inside the collection and do what the inside of each.do iteration programs it to do.
First it will read the data inside the array 1 by 1 while doing the code that is programmed it to do. The name inside the pipe |number| can be called anything you want its just a way to call each of the data that is inside the array individually. You can put anything inside the iteration that you want the data to do.(as long as it is valid and functional)
This is the result for all the data that is inside of the array each individual data was minus 1 from 10 to 1 until there is no more data inside the array. Now just remember to first have a collection of valid data not a mix of integers and strings then second is a valid and functional action you need the data to do.