Making a deck of cards

Hi so I get this error in my code and I really don't know what it means. If someone know, please help.

var deckOne = makeDeckOfCards()

Error: Cannot use instance member 'makeDeckOfCards' within property initializer; property initializers run before 'self' is available

The error message says everything you need to know. You are calling the method of the type that you initialize before every stored property was actually initialized, that is illegal.

Okey thanks, do you know how I fix it?

We need to see more code to answer that in context.

Terms of Service

Privacy Policy

Cookie Policy