# Switch state not false or true

**URL:** <https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite\
**Created:** [March 14, 2023, 7:39pm UTC](https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835 "2023-03-14T19:39:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FinestCreative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/finestcreative/32/1034971_2.png) [@FinestCreative](https://forums.unrealengine.com/u/FinestCreative)\
**Post date:** [March 14, 2023, 7:39pm UTC](https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835/1 "2023-03-14T19:39:53Z")

</div>

A trigger calls this function with parameters Agent and some int ID. Switch is a switch\_device in an array of Switches.

But when I check the state it is not true and it is also not not true. It always prints the final ‘else’

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/7/d/67de5bcdd0ee20dea63ebcc20e1bc96a445c3d9a.png)

---

<div class="post-metadata">

**Author:** ![BrendannnD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BrendannnD](https://forums.unrealengine.com/u/BrendannnD)\
**Post date:** [March 14, 2023, 11:41pm UTC](https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835/2 "2023-03-14T23:41:13Z")

</div>

For whatever reason, GetCurrentState has a void return type so it’s comparing void to true every time. It seems like a bug, I would report it.

---

<div class="post-metadata">

**Author:** ![Conan\_Reis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/conan_reis/32/1016955_2.png) [@Conan\_Reis](https://forums.unrealengine.com/u/Conan_Reis)\
**Post date:** [March 18, 2023, 1:09am UTC](https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835/3 "2023-03-18T01:09:19Z")

</div>

`GetCurrentState[]` is a `<decides>` function which means that it either fails or succeeds - the tipoff is that it is called with square brackets `[]`. The function documentation isn’t clear - it doesn’t return a `logic` (`true`/`false`), the call itself is all that is needed.

```python
if (Switch.GetCurrentState[Agent]):
    Print("meow")
else:
    Print("meow!")

```

Alternatively:

```python
Print(if (Switch.GetCurrentState[Agent]) {"meow"} else {"meow!"})

```

---

<div class="post-metadata">

**Author:** ![Conan\_Reis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/conan_reis/32/1016955_2.png) [@Conan\_Reis](https://forums.unrealengine.com/u/Conan_Reis)\
**Post date:** [March 18, 2023, 1:11am UTC](https://forums.unrealengine.com/t/switch-state-not-false-or-true/790835/4 "2023-03-18T01:11:35Z")

</div>

I didn’t see until now that this question was double posted.

> [@Major - Switch device functions yielding the wrong types](https://forums.unrealengine.com/t/major-switch-device-functions-yielding-the-wrong-types/791175/2):
>
> In the case of GetCurrentState, the decides effect is used, rather than returning logic. To have your code work, you would need to update it to if (not Switch.GetCurrentState[Agent]): Print("meow") else if (Switch.GetCurrentState[Agent]): Print("meow") GetCurrentState will fail (rather than return false) or succeed (rather than return true). Related to use of tuple() with listenable: this is to indicate Await (a method of the superinterface awaitable) produces value () - note () is a…

So essentially the same answer.
