0
My isn't my code working?
What am I missing here? Why does this output an error for me: [ ..\Playground\:14:in `<main>': undefined local variable or method `loud' for main:Object (NameError ] class Dog def bark(noise) @noise = n if @noise == loud puts "WOOF!" elsif @noise == soft puts "woof" else puts "..." end end end d = Dog.new(loud) d.bark
3 Answers
+ 2
loud and soft are not defined anywhere - do you want to pass them as strings? or as an enumerated type (which must be defined too)
0
@Dan Walker pass them as strings so how would I do that?