Suggested approach: Enum associated values let us attach one or more extra pieces of data to enum cases – that much is easy enough. However, the key word here is “useful”, which means you need to provide an example that is even vaguely real world.
For instance, you might describe a weather enum that lists sunny, windy, and rainy as cases, but has an associated value for cloudy so that you can store the cloud coverage. Or you might describe types of houses, with the number of bedrooms being an associated integer.
It doesn't really matter what example you choose, because the point is to show you understand why they are useful outside of a textbook!
Estimated difficulty: Intermediate
#errorcompiler directive do?
#if swiftsyntax do?
Link copied to your pasteboard.