# If and return

**URL:** <https://forum.makecode.com/t/if-and-return/47118>\
**Category:** Help\
**Created:** [November 8, 2026, 9:28pm UTC](https://forum.makecode.com/t/if-and-return/47118 "2026-11-08T21:28:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/36911_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [November 8, 2026, 9:28pm UTC](https://forum.makecode.com/t/if-and-return/47118/1 "2026-11-08T21:28:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/6/167eaa7a10e334b2eef3ce28c0b4f4f16db5b2bd.png)

So if I don’t return a value at the end of the statement it gievs an error but if i do it has a fixed return value. is there any way to make it so that i dont return a value at the end?

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [November 8, 2026, 9:30pm UTC](https://forum.makecode.com/t/if-and-return/47118/2 "2026-11-08T21:30:37Z")

</div>

Not in Blocks, no, since functions can only have a single return type. The standard mechanism for something like this is to return a _sentinel value_, like `-999`.

In TypeScript, you can fake it by declaring the return type as a union type:

```typescript
function direction (multiplier: number): number | void {
...
}

```

---

<div class="post-metadata">

**Author:** ![TheGooberEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thegooberearth/32/36693_2.png) [@TheGooberEarth](https://forum.makecode.com/u/TheGooberEarth)\
**Post date:** [November 9, 2026, 3:49am UTC](https://forum.makecode.com/t/if-and-return/47118/3 "2026-11-09T03:49:43Z")

</div>

yeah with the | isn’t that also bitwise or?
