# IF Statement trouble

**URL:** <https://forum.dynamobim.com/t/if-statement-trouble/68998>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [October 6, 2021, 5:41pm UTC](https://forum.dynamobim.com/t/if-statement-trouble/68998 "2021-10-06T17:41:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernand77](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@Fernand77](https://forum.dynamobim.com/u/Fernand77)\
**Post date:** [October 6, 2021, 5:41pm UTC](https://forum.dynamobim.com/t/if-statement-trouble/68998/1 "2021-10-06T17:41:16Z")

</div>

Hello everyone,

Who can help me with the following.

My IF Statement only returns the 0 index and not the entire sublist.

Who can help me?

Thanks in advance!

 ![afbeelding](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/9/39597943a4106fa3d97b14dd098dd0cfcb5f3de7.png)

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [October 6, 2021, 6:26pm UTC](https://forum.dynamobim.com/t/if-statement-trouble/68998/2 "2021-10-06T18:26:29Z")

</div>

@Fernand77 For me, the easiest way out would be to put a Code Block as below:

 ![123](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/5/151dedb0e6cff09a564b93a936e12e6307bf1bd6.png)

```auto
[ifTrue,ifFalse][check?0:1];

```

This issue has been discussed in many topics, try searching the forum for more options!

---

<div class="post-metadata">

**Author:** ![EdsonMatt](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/edsonmatt/32/124725_2.png) [@EdsonMatt](https://forum.dynamobim.com/u/EdsonMatt)\
**Post date:** [October 6, 2021, 6:30pm UTC](https://forum.dynamobim.com/t/if-statement-trouble/68998/3 "2021-10-06T18:30:06Z")

</div>

Here’s another solution:

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/1/a14ed814e27a4e1d71d8afc9b86094055ab572d4.jpeg)

 ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/7/07c9291e505117eed0262bbf86718b3dafe2e42c.jpeg)

```auto
ibool;
lst1;
lst2;
c = [Imperative]
{
if(ibool==true)
{return lst1;
}
else
{return lst2;
}
};

```

---

<div class="post-metadata">

**Author:** ![Fernand77](https://avatars.discourse-cdn.com/v4/letter/f/74df32/32.png) [@Fernand77](https://forum.dynamobim.com/u/Fernand77)\
**Post date:** [October 7, 2021, 6:10am UTC](https://forum.dynamobim.com/t/if-statement-trouble/68998/4 "2021-10-07T06:10:51Z")

</div>

Great this is what I was looking for!

Thanks for the responses.
