Oops, try again



Oops, try again. It looks like your iterator syntax isn't quite correct--check the Hint if you need help.
(ruby):1: syntax error, unexpected $end

list1 = [1, 2, 3,4,5]
 for i in range(0,len(list1)) ;


The above is Python code, not Ruby. In Ruby a range is written,

0..array.length (inclusive of last value in range)


0...array.length (exclusive of last value range)

So a for loop would look something like this...

for i in 0...list1.length
    puts list1[i]

Only problem is that lesson 12 asks us to use the .each method for this loop.


@mtf thank you for your help! smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.