Skip to content

Instantly share code, notes, and snippets.

@HeidiHansen
Created September 8, 2014 03:23
Show Gist options
  • Save HeidiHansen/32bf35f71452f3c26396 to your computer and use it in GitHub Desktop.
Save HeidiHansen/32bf35f71452f3c26396 to your computer and use it in GitHub Desktop.
Nested Control Statements
- (void)grow
{
if (self.isFemale){
if ([self.age integerValue] < 11){
self.height = @([self.height floatValue] + [self randomFloatBetweenNumber:0 andNumber:1]);
}
else if ([self.age integerValue] >= 11 && [self.age integerValue] <= 15){
self.height = @([self.height floatValue] + [self randomFloatBetweenNumber:.5 andNumber:2]);
}
}
else {
if ([self.age integerValue] < 12){
self.height = @([self.height floatValue] + [self randomFloatBetweenNumber:0 andNumber:1]);
}
else if ([self.age integerValue] >= 12 && [self.age integerValue] <= 16){
self.height = @([self.height floatValue] + [self randomFloatBetweenNumber:.5 andNumber:3.5]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment