Undefined local variable for hash in method ruby

后端 未结 3 1643
别那么骄傲
别那么骄傲 2020-12-12 05:21

for some reason I\'m getting

NameError: undefined local variable or method `states\' for main:Object

though states is clearly defined. What

3条回答
  •  情话喂你
    2020-12-12 06:00

    states and cities are not defined in the function pass them in like

    def describe_state state, states, cities
     ..
    end
    puts describe_state :CA, states, cities
    

    will work

提交回复
热议问题