I'm trying to print all the values from an object that inherits from a class, here is my example:

I create the class:

```
 class Pokemon {

 var name: String?
 var type: String?
 var level: Int?
 var exp = 0.0
}

```

Create the object and assign some values:

```
var pikachu = Pokemon()

pikachu.name = "Pika Pika"
pikachu.level = 1
pikachu.type = "electricity"
pikachu.exp = 0

```

Now I would like to loop through all the pikachu object attributes and print the values. I'm thinking in a for each loop but I'm not sure how to implement it.

I know I can do something like this:

```
func printStats(pokemon: Pokemon) {

if pokemon.name != nil {

    print(" name: \(pokemon.name!)\n level:\(pokemon.level!)\n type:\(pokemon.type!)\n exp: \(pokemon.exp!)")

 }
}

printStats(pokemon: pikachu)

```

output: 

```
name: Pika Pika
level:1
type:electricity
exp: 0.0

```

But I just want to loop through all values, instead of explicit writing every attribute in the function.