Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Alphonse Cuccurullo
Alphonse Cuccurullo
2,513 Points

Levels too deep?

Its telling me on the command promp that the type commands levels under the case statement are too deep. Whats that mean?

class Pokemon attr_reader :name, :type, :attacks, :hp

def initialize(name, type, attacks, hp) @name = name @type = type @attacks = {} end

def type case type

when "electric" then puts "#{name} is a electric pokemon. Electric pokemon are weak to Ground and grass type pokemon. Electric attacks are super effective to water and flying types" when "water" then puts " #{name} is a water type pokemon. Water types are weak to electric and grass type pokemon. All water types attacks are super effective to fire and ground types." when "grass" then puts "#{name} is a grass type pokemon. Grass type pokemon are weak to fire and ice attacks. There attacks are super effective against electric and water types." when "fire" then puts "#{name} is a fire type pokemon. Fire types are weak to water and ground types. There attacks are super effective to grass and fighting types." when "fighting" then puts "#{name} is a fighting pokemon and is weak to psychic. There attacks are super effective against flying types." when "rock" then puts"#{name} is weak to water attacks. Rock type attacks are super effective against fighting types." when "dragon" then puts "#{name} is a dragon type pokemon. Dragon types are weak to ice type attacks. Dragon attacks are super effective against other dragons." end end

end

pikachu = Pokemon.new("pikachu","electric","",90)

pikachu.type