Sha256: 01a7dc667ad8ea4b471dae8732f5ccace92e122e8114c4df256813026c4b953f

Contents?: true

Size: 652 Bytes

Versions: 396

Compression:

Stored size: 652 Bytes

Contents

#import "RaindropsExample.h"

@implementation Raindrops {
    int _number;
}

- (instancetype)initWithNumber:(int)number {
    if (self = [super init]) {
        _number = number;
    }
    
    return self;
}

- (NSString *)sounds {
    NSMutableString *result = [[NSMutableString alloc] init];
    
    if (_number % 3 == 0) {
        [result appendString:@"Pling"];
    }
    
    if (_number % 5 == 0) {
        [result appendString:@"Plang"];
    }
    
    if (_number % 7 == 0) {
        [result appendString:@"Plong"];
    }
    
    if (result.length == 0) {
        [result appendFormat:@"%d", _number];
    }
    
    return result;
}

@end

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.179 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.178 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.177 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.176 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.175 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.174 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.173 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.172 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.171 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.170 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.169 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.167 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.166 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.165 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.164 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.163 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.162 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.161 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.160 tracks/objective-c/exercises/raindrops/RaindropsExample.m