It seems that the code in `if` will be executed only if `i != current` and `val && [self isCurrentPosition:i]` or `!val`, so you could merge all the `if`s into one: - (void) cleanTextfieldExcluding:(int)current checkPosition:(BOOL)val { for ( int i=0; i<[self count]; i++ ) { // ----------- if ( (i != current) && (!val || [self isCurrentPosition:i]) ) { [self replaceObjectAtIndex:i withObject:@""]; } // ----------- } }