# True false switch challenge

**URL:** <https://forum.dynamobim.com/t/true-false-switch-challenge/10060>\
**Category:** Uncategorized\
**Tags:** dynamo\
**Created:** [March 4, 2017, 1:34am UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060 "2017-03-04T01:34:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsandersin\_tsandersi](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tsandersin\_tsandersi](https://forum.dynamobim.com/u/tsandersin_tsandersi)\
**Post date:** [March 4, 2017, 1:34am UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/1 "2017-03-04T01:34:08Z")

</div>

I need to make a 3 option switch in dynamo, made from “true” “false”. This is what I came up with. This works fine. But I know there is a better way to write this, maybe with IF else statements. I was curious to see other creative ways to slim this down further, perhaps using just design script?

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/4/04f4b21b2af0e55e572953bca1aa7044d1ca0462.JPG)

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [March 5, 2017, 1:16pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/2 "2017-03-05T13:16:52Z")

</div>

Maybe with an _if / elif / else_ statement? In this case, see here:  
[https://forum.dynamobim.com/t/swap-empty-main-list/9843/5](https://forum.dynamobim.com/t/swap-empty-main-list/9843/5)  
[https://forum.dynamobim.com/t/how-to-write-simple-if-elif-else-conditional-in-python/9632](https://forum.dynamobim.com/t/how-to-write-simple-if-elif-else-conditional-in-python/9632)

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [March 7, 2017, 1:12pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/3 "2017-03-07T13:12:14Z")

</div>

Here’s a design script method that uses nested boolean’s, its not very slim, but it is all in a single code block, maybe that qualifies for creative at least

> // if bool\_1 is False  
> // list\_1F with true and false values at index 1 & 0  
> // return either index 1 or 0 of list\_1F depending on bool\_1F  
> test\_F = false;  
> test\_Ff = “Ff”;  
> test\_Ft = “Ft”;  
> list\_1F = {test\_Ff, test\_Ft};  
> bool\_1F = list\_1F [test\_F ? 1 : 0];

> // if bool\_1 is True  
> // list\_1T with true and false values at index 1 & 0  
> // return either index 1 or 0 of list\_1T depending on bool\_1T  
> test\_T = true;  
> test\_Tf = “Tf”;  
> test\_Tt = “Tt”;  
> list\_1T = {test\_Tf, test\_Tt};  
> bool\_1T = list\_1T [test\_T ? 1 : 0];

> // bool\_1  
> // list\_1 with true and false values at index 1 & 0  
> // return either index 1 or 0 of list depending on bool\_1  
> test\_1 = false;  
> list\_1 = {bool\_1F, bool\_1T};  
> bool\_1 = list\_1 [test\_1 ? 1:0];

---

<div class="post-metadata">

**Author:** ![tothom](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tothom](https://forum.dynamobim.com/u/tothom)\
**Post date:** [March 7, 2017, 1:33pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/4 "2017-03-07T13:33:02Z")

</div>

Hi

What about this?

```
options = {{false, true}, {false, false},{true, false}};
out0 = options[i][0];
out1 = options[i][1];

```

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

Thomas Holth

---

<div class="post-metadata">

**Author:** ![tothom](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tothom](https://forum.dynamobim.com/u/tothom)\
**Post date:** [March 7, 2017, 1:33pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/5 "2017-03-07T13:33:55Z")

</div>

Actually the variables out0 and out1 are not necessary…

---

<div class="post-metadata">

**Author:** ![tsandersin\_tsandersi](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tsandersin\_tsandersi](https://forum.dynamobim.com/u/tsandersin_tsandersi)\
**Post date:** [March 7, 2017, 5:13pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/6 "2017-03-07T17:13:03Z")

</div>

Nice! I like seeing all these. Helps to see different approaches. so something like this

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/d/4d4871776311fc38d765d3c35618de6b4973dc09.png)

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [March 9, 2017, 2:12pm UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/7 "2017-03-09T14:12:21Z")

</div>

this is a bit slimer…

> //input bool tests  
> bool\_1 = true;  
> bool\_2 = true;

> //convert bool to int as clockwork  
> //provide list\_bool to match first index against  
> first\_bool = {false, true};  
> B1 = List.FirstIndexOf(first\_bool, bool\_1);  
> B2 = List.FirstIndexOf(first\_bool, bool\_2);

> //output index of list\_string  
> list\_string = {{“Ff”,“Ft”},{“Tf”,“Tt”}};  
> list\_string[B1][B2];

---

<div class="post-metadata">

**Author:** ![Dimitar\_Venkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dimitar_venkov/32/2068_2.png) [@Dimitar\_Venkov](https://forum.dynamobim.com/u/Dimitar_Venkov)\
**Post date:** [March 10, 2017, 8:08am UTC](https://forum.dynamobim.com/t/true-false-switch-challenge/10060/8 "2017-03-10T08:08:11Z")

</div>

![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/c/3cc6233b379f5cd000bd7ab1b9beafc8479139db.gif)
