# Creating an multi handler function in an extension

**URL:** <https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041>\
**Category:** micro:bit extensions\
**Created:** [September 15, 2021, 8:45pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041 "2021-09-15T20:45:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronzi](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ronzi](https://forum.makecode.com/u/Ronzi)\
**Post date:** [September 15, 2021, 8:45pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/1 "2021-09-15T20:45:49Z")

</div>

Hello everyone, I am trying to create a new block using an extension. I want the block to handle more the one handler, an example for it can be the if+else block in the logic section.

\*At first I need it to handle only 2 handlers(like if+else), but it would be even better if it was expandable(like the if).

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/91cd4bf1861c380b800362d0f7e5b63552f940c3.png)

Does anyone know how to make it happen?  
\*A code of the “if” block by MakeCode as in the photo would help me a lot.

Thank you.

---

<div class="post-metadata">

**Author:** ![E-EnerG-Gamecentral](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/e-energ-gamecentral/32/5353_2.png) [@E-EnerG-Gamecentral](https://forum.makecode.com/u/E-EnerG-Gamecentral)\
**Post date:** [September 16, 2021, 6:18pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/2 "2021-09-16T18:18:27Z")

</div>

> [@Ronzi](#):
>
> it would be even better if it was expandable

@Ronzi It is expandable

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1564749c23e53f3bbc5459613cca2fb123275585.jpeg)  
Press the plus button to make it expandable.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/080b53a2868d87dcffdb2662adb0785992cd86e1.png)

---

<div class="post-metadata">

**Author:** ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)\
**Post date:** [September 17, 2021, 5:39am UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/3 "2021-09-17T05:39:22Z")

</div>

This may not solve your problems, but the MakeCode playground is a great tool to explore the block styles and prototype blocks. See: [https://makecode.com/playground](https://makecode.com/playground) .

About the closest example is has is the in-line [event handler](https://makecode.com/playground#events).

---

<div class="post-metadata">

**Author:** ![Ronzi](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ronzi](https://forum.makecode.com/u/Ronzi)\
**Post date:** [September 17, 2021, 4:02pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/4 "2021-09-17T16:02:29Z")

</div>

Unfortunately I couldn’t find it there.  
Thank you for your answer though.

---

<div class="post-metadata">

**Author:** ![Ronzi](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ronzi](https://forum.makecode.com/u/Ronzi)\
**Post date:** [September 17, 2021, 4:02pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/5 "2021-09-17T16:02:36Z")

</div>

yes, I am aware of that. My question is how I make a block that acts in that way(In an extension).

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 17, 2021, 5:05pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/6 "2021-09-17T17:05:24Z")

</div>

@Ronzi We don’t have a way to do this, the if-block is special. If you want, you can open an issue for this on our GitHub: [https://github.com/microsoft/pxt-arcade/issues](https://github.com/microsoft/pxt-arcade/issues)

---

<div class="post-metadata">

**Author:** ![Ronzi](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Ronzi](https://forum.makecode.com/u/Ronzi)\
**Post date:** [September 17, 2021, 6:17pm UTC](https://forum.makecode.com/t/creating-an-multi-handler-function-in-an-extension/10041/7 "2021-09-17T18:17:52Z")

</div>

Ok, great.  
Thank you very much.
