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.159 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.158 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.157 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.156 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.155 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.154 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.153 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.152 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.151 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.150 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.149 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.148 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.147 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.146 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.145 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.144 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.143 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.142 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.141 tracks/objective-c/exercises/raindrops/RaindropsExample.m
trackler-2.2.1.140 tracks/objective-c/exercises/raindrops/RaindropsExample.m