- case credit, debit
- }
- enum Card: String {
- var description: String {
- return self.rawValue
- }
- var C = Card.credit
- print(c.description)
Is this homework?
No it’s app Mimo for IPhone. I can’t sleep because that! Help me!
Could you?
I think you’ll benefit from reading the introductory documentation A Swift Tour
Not cool men
1a troll
What that’s mean??
Just solve this problem and end of subject.
Hey Bart,
This an interesting question format, haven't seen something like this before. I would recommend you doodle out the dependancies you can identify, and use those to try to progress.
I've give you an example: print(c.description)
only works if c
exists by the time the print
line has been reached. So clearly, var c = Card.credit
must come at some point before print(c.description)
.
What other dependancies like this can you find?
enum Card: String {
case credit, debit
var description: String {
return self.rawValue
}
}
var c = Card.credit
print(c.description)
Thank you so much Ray!
You mentioned it’s a question in the Mimo app. The purpose of the app seems to be to teach people how to write code.
You won’t learn how to write any code by asking people to solve problems for you. The best way to learn is to solve problems by yourself. Just an advice, don’t get discouraged :)
Why would you just give away the answer? Nothing constructive came of that.
Because that's what he asked for.
That's an assumption you're making and I would have to disagree with you. You don't know for certain that Bart hasn't learnt something from being shown the correct way to structure the definition of an enum and then put it to use. This is exactly how we learn when we read through the Swift Language Guide. We are repeatedly shown how to define and use elements of the language. It was pretty obvious from the content of the question that Bart isn't familiar with correct way to define an enum, and I really don't think that showing him how can be unconstructive, or rob him of his learning experience.