---
title: "Utilizing array in Objective-C?"  
description: "Utilizing array in Objective-C?"  
author: "Anonymous User"  
published: 2015-12-26  
updated: 2015-12-27  
canonical: https://www.mindstick.com/forum/33792/utilizing-array-in-objective-c  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Utilizing array in Objective-C?

I want to utilize [boolean](https://www.mindstick.com/forum/160332/how-does-the-boolean-function-work) [array](https://www.mindstick.com/articles/335/jagged-array-in-c-sharp-dot-net) in [Objective C](https://www.mindstick.com/interview/22819/objective-c-vs-c-plus-plus) programming. I have got it mostly set up, but the [compiler](https://www.mindstick.com/articles/27/just-in-time-compiler) throws a [warning](https://answers.mindstick.com/blog/77/psychological-risks-of-ai-chatbots-what-experts-are-warning-about) at the following statement:\
[userObj replaceObjectAtIndex:[index](https://www.mindstick.com/blog/198/index-in-sql-server) withObject:[YES](https://www.mindstick.com/forum/157763/how-to-return-yes-no-based-on-date-comparison-in-sql)];\
YES is simply not an object.(This is my [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view))

It is a primitive, regardless I need to do this, and would greatly appreciate [advice](https://yourviews.mindstick.com/view/50528/filament-advice-5-things-to-consider-before-you-buy-a-filament) on how to accomplish it.\
Thankyou.

## Replies

### Reply by Tarun Kumar

We can do this by wrapping it up in an NSNumber, like this:

```
[userObj replaceObjectAtIndex:index withObject:[NSNumber numberWithBool:YES]];
```

or we can use @(YES), it will wraps a BOOL in an NSNumber, like this:

```
[userObj replaceObjectAtIndex:index withObject:@(YES)]];
```

Now, we can use it by pulling out the bool value, like this:

```
BOOL mine = [[userObj objectAtIndex:index] boolValue];
```


---

Original Source: https://www.mindstick.com/forum/33792/utilizing-array-in-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
