Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

Ruby While Loops

index = 1
while index <= 5
	puts index
    index +=1
end

for index in 0..5
  puts index
end

5.times do |index|
  puts index
end

my_array = [25,14,3,6,45,19]

for my_array in my_array
  puts my_array
end

my_array.each do |arr|
  puts arr
end
 
PREVIOUS NEXT
Tagged: #Ruby #While #Loops
ADD COMMENT
Topic
Name
8+3 =