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

31st Aug 2018, 7:31 PM
Joe Spinelli
Joe Spinelli - avatar
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)
31st Aug 2018, 7:41 PM
Dan Walker
Dan Walker - avatar
0
@Dan Walker pass them as strings so how would I do that?
1st Sep 2018, 6:15 PM
Joe Spinelli
Joe Spinelli - avatar