List Class Guidelines no 3 | My program runner doesn't work


#1

Off to a great start, can't get the first thing working.

"Beneath the class List write code to run the program. We'll refer to this as the program runner through the course of this lesson."

I've added this:

class List
  if __FILE__ == $PROGRAM_NAME
    my_list = List.new
    puts 'You have created a new list'
end

I get the error:
todo.rb:7: syntax error, unexpected end-of-input, expecting keyword_end

I also tried defining a runner method but I still get the same error.


#2

I don’t know if it’s still relevant, but i think the “programm runner” cant be in the class.


#3

This is really relevant, I’ve made same mistake for hours and got really frustrated after discover that it needs to be out of class declaration.