Bronze Challenge Solution - Optionals

Hello :slight_smile:

I only recently started this book and found the chapter on optionals quite intense :slight_smile:

I was curious to see how you approached the bronze challenge in this chapter, as I found out this book has no solutions which can be frustrating.

I personally think the first point:

Number of kids a parent has is an Int (but i believe this question might be a trick one)
name of a person’s pet is String?

What do you think? Thanks!

I agree with you. You can have 0 kids so Int is fine. If you don’t have a pet then you need it to be able to be nil so string? is best.

1 Like

That was my thought as well.