# Ifempty: bug or design?

**URL:** <https://community.weweb.io/t/ifempty-bug-or-design/1206>\
**Category:** How do I?\
**Created:** [September 30, 2022, 8:23pm UTC](https://community.weweb.io/t/ifempty-bug-or-design/1206 "2022-09-30T20:23:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsatl](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@hsatl](https://community.weweb.io/u/hsatl)\
**Post date:** [September 30, 2022, 8:23pm UTC](https://community.weweb.io/t/ifempty-bug-or-design/1206/1 "2022-09-30T20:23:42Z")

</div>

I think the logic for ifempty is not explained properly in the hint (I should not call it documentation). Typically you would expect the behavior like this:  
ifempty(expression, result1, result2)

If the result of expression is empty then “result1” is the output otherwise “result2”.

But actually what is happening is that if expression is empty then result1 is the output. but if it is not empty, then the output of the expression is the output. Result2 is completely ignored.

Is this a bug? Or simply my misunderstanding of the function?

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [October 2, 2022, 8:33pm UTC](https://community.weweb.io/t/ifempty-bug-or-design/1206/2 "2022-10-02T20:33:57Z")

</div>

Its a misstypo in the hint. The description is for if function, ifempty is returning the second parameter if first is empty, or first parameter if not.

---

<div class="post-metadata">

**Author:** ![hsatl](https://avatars.discourse-cdn.com/v4/letter/h/67e7ee/32.png) [@hsatl](https://community.weweb.io/u/hsatl)\
**Post date:** [October 3, 2022, 1:46am UTC](https://community.weweb.io/t/ifempty-bug-or-design/1206/3 "2022-10-03T01:46:08Z")

</div>

Thanks @aurelie.
