hi i don't understand this code of course CS193p
[[PlayingCard rankStrings][self.rank] stringByAppendingString:self.suit];
where rankString is variable method
+ (NSArray *)rankStrings
{
return @[@"?", @"A", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", @"J", @"Q", @"K"];
}
self.rank is a getter of random number
@property (nonatomic) NSUInteger rank;
and self.suit in another variable method
+ (NSArray *)validSuits
{
return @[@"♥️", @"♦️", @"♠️", @"♣️"];
}
I insert in my code NSLog to understand the functioning .... I understand that it takes rank from the rankStrings and concatenates them with the suit .... but I don't understand how! the method appendingString is clear ... but how do you get the values rank from an rankStrings? the [PlayingCard rankStrings] is simple call to a method of variable and NSUInteger rank is a getter