# There is a problem with my game

**URL:** <https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477>\
**Category:** Help\
**Created:** [December 24, 2021, 8:39am UTC](https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477 "2021-12-24T08:39:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoftTalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/softtalker/32/10776_2.png) [@SoftTalker](https://forum.makecode.com/u/SoftTalker)\
**Post date:** [December 24, 2021, 8:39am UTC](https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477/1 "2021-12-24T08:39:20Z")

</div>

![Screenshot (1339)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/78b08706fed4bbf6deb832b8f81ab9164988c7ff.png)

please check the code to understand  
Btw this game in coming soon

> **[Mini Quest(IN PROGRESS)](https://arcade.makecode.com/12913-34977-85689-71920)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [December 27, 2021, 7:11pm UTC](https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477/2 "2021-12-27T19:11:59Z")

</div>

The problem is that not all code paths return a value.

Say if the name is `abc`. Then it returns the result of `Create_Battle`. Everyone is happy.

If the name isn’t `abc` but it is `cba` then it returns the value of `Create_Battle`. Everyone is still happy.

But what if the name isn’t either of them? Then the function doesn’t return anything and so then the TypeScript compiler gets angry.

What you could do is return a default “battle” (didn’t look into your code) if none of the conditions are true.

---

<div class="post-metadata">

**Author:** ![SoftTalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/softtalker/32/10776_2.png) [@SoftTalker](https://forum.makecode.com/u/SoftTalker)\
**Post date:** [December 28, 2021, 7:32pm UTC](https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477/3 "2021-12-28T19:32:36Z")

</div>

sorry idk what you mean

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [December 28, 2021, 9:15pm UTC](https://forum.makecode.com/t/there-is-a-problem-with-my-game/11477/4 "2021-12-28T21:15:22Z")

</div>

Basically if the parameter `Name` doesn’t match “abc” or “cba” then the function doesn’t return anything, so the TypeScript compiler gets angry about. So at the very bottom of the function you need to return a default value, like maybe the output of `Create_Battle` with default parameters.
