Check out example codes for "Ruby difference between for and .each". It will help you in understanding the concepts better.

Code Example 1

# They are both similar in function, however the for loop will retain a variable.
# FOR Example:
nums = [1,2,3]

for n in nums
	puts n
=> 1 2 3

# If you ask what is n, n outputs the last assignment from the function.
n => 3

# EACH Example:

nums.each do |i|
	puts i
=> 1 2 3

# If you ask what is i.
i => NameError (undefined local variable or method `i' for main:Object)

Learn ReactJs, React Native from