# IF statement

**URL:** <https://forum.dynamobim.com/t/if-statement/79244>\
**Category:** Uncategorized\
**Tags:** dynamo\
**Created:** [July 28, 2022, 3:24pm UTC](https://forum.dynamobim.com/t/if-statement/79244 "2022-07-28T15:24:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [July 28, 2022, 3:24pm UTC](https://forum.dynamobim.com/t/if-statement/79244/1 "2022-07-28T15:24:54Z")

</div>

hi;  
I have created a code block for the if statement, but when I put a list for the value of x, I don’t get any result.

x;  
p = [Imperative]  
{  
if(x==90)  
{return = x+90;  
}  
else  
{  
return = x;  
}  
};

Can someone point out my error?

 ![Dynamo IF](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/4/74bb86b024d945f73f5bf8a3a35f25412343a567.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [July 28, 2022, 3:29pm UTC](https://forum.dynamobim.com/t/if-statement/79244/2 "2022-07-28T15:29:14Z")

</div>

@outmanechamekh ,

at least it is a workaround 😉

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/23f2b94590b8c1d1604fc7960a4519318c101e00.png)

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [July 28, 2022, 3:38pm UTC](https://forum.dynamobim.com/t/if-statement/79244/3 "2022-07-28T15:38:09Z")

</div>

Thanks for help,  
But why the first code does not work.  
One more thing I have the same problem with Python script

 ![Dynamo IF.1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/4/44fb0e2be6cef2c7db050aa73a63dc28c5c6ea57.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [July 28, 2022, 3:43pm UTC](https://forum.dynamobim.com/t/if-statement/79244/4 "2022-07-28T15:43:32Z")

</div>

@outmanechamekh ,

```auto
nums = IN[0]

OUT = []

for i in nums:
	if i == 90:
		OUT.append(i+90)
	else:
		OUT.append(i)

```

 ![2022-07-28_17h43_00](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/4/94311c1817b8ce8b1955e19f79691ae5280a6a69.png)

in a programm language you have to explan each step! at least Python is not asking “why…”

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 28, 2022, 4:03pm UTC](https://forum.dynamobim.com/t/if-statement/79244/6 "2022-07-28T16:03:20Z")

</div>

Hello

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/e/feaca62117b0769e02435191216bef63a0f3c2f9.png)

Code Block:

```auto
x;
Nb_item=DSCore.List.Count(x);
z=[];
p=[Imperative]
{
for (i in 0..(Nb_item-1))
	{
		if (x[i]==90)
			{
			z[i]=x[i]+90;
			}
		else
			{
			z[i] =x[i];
			}
	}
	return z;
};

```

Cordially  
Christian.stan

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [July 28, 2022, 4:47pm UTC](https://forum.dynamobim.com/t/if-statement/79244/7 "2022-07-28T16:47:04Z")

</div>

@christian.stan ,

where did you get this knowlage, for me its hard to learn, based the recources here… 😉, is there more to designscript as the guide?

---

<div class="post-metadata">

**Author:** ![outmanechamekh](https://avatars.discourse-cdn.com/v4/letter/o/3ab097/32.png) [@outmanechamekh](https://forum.dynamobim.com/u/outmanechamekh)\
**Post date:** [July 28, 2022, 4:56pm UTC](https://forum.dynamobim.com/t/if-statement/79244/8 "2022-07-28T16:56:21Z")

</div>

> [@Draxl\_Andreas](#):
>
> based the recources here

Based the recources here and youtube.  
I don’t have any other sources or guide. 😅

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 28, 2022, 6:07pm UTC](https://forum.dynamobim.com/t/if-statement/79244/9 "2022-07-28T18:07:32Z")

</div>

Hello,  
I like the work of Mr. Sol Amour (Will stop, he will think that I am a stalker)  
+designscript guide  
+I try to visualize and understand the scripts of Mr. Vikram Subbaiah  
and so many other people (I absorb)

Here is a knowledge slider 😉 (

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/e/ceeaff26ffd85349e1833d4d879a19933c1c784b.png)

code block:

```auto
[Line.ByStartPointEndPoint(
Point.ByCoordinates(0,0),
Point.ByCoordinates(10,0)),
Line.ByStartPointEndPoint(
Point.ByCoordinates(0,-0.2),
Point.ByCoordinates(0,0.2)),
Line.ByStartPointEndPoint(
Point.ByCoordinates(10,-0.2),
Point.ByCoordinates(10,0.2))];
GeometryColor.ByGeometryColor(
Cylinder.ByPointsRadius(Point.ByCoordinates(0,0),
Point.ByCoordinates(Knowledge*10,0),0.2),
Color.ByARGB(255,0,255,0));

```

good evening  
Cordially  
christian.stan

> [@Kindly please interpretation](https://forum.dynamobim.com/t/kindly-please-interpretation/77995/4):
>
> Hello here is shared knowledge good reading and setting Cordially christian.stan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 29, 2022, 12:21am UTC](https://forum.dynamobim.com/t/if-statement/79244/10 "2022-07-29T00:21:35Z")

</div>

For your python issue your if statement is asking “is this list equal to 90? and is 180?” Because you have a list you will need to iterate over it.
