# "IF" returns error for false result (what is expected behaviour?)

**URL:** <https://community.weweb.io/t/if-returns-error-for-false-result-what-is-expected-behaviour/808>\
**Category:** How do I?\
**Created:** [July 16, 2022, 8:13am UTC](https://community.weweb.io/t/if-returns-error-for-false-result-what-is-expected-behaviour/808 "2022-07-16T08:13:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 17, 2022, 10:44am UTC](https://community.weweb.io/t/if-returns-error-for-false-result-what-is-expected-behaviour/808/4 "2022-07-17T10:44:49Z")

</div>

when result.index is -1 `getByIndex` returns `undefined` and `getKeyValue` throws an error because it needs an object. The first argument of `getKeyValue` should default to an empty object if `getByIndex` returns `undefined`, or just use an `if else` statement instead of the nocode `if` function

---

_[View the full topic](https://community.weweb.io/t/if-returns-error-for-false-result-what-is-expected-behaviour/808)._
