# Switch Statements

**URL:** <https://forum.makecode.com/t/switch-statements/40933>\
**Category:** Help\
**Created:** [December 14, 2025, 3:02am UTC](https://forum.makecode.com/t/switch-statements/40933 "2025-12-14T03:02:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [December 14, 2025, 3:02am UTC](https://forum.makecode.com/t/switch-statements/40933/1 "2025-12-14T03:02:32Z")

</div>

@richard, could you please add switch statements to block coding? it simplifies things like having many tilemaps, so that somebody isnt doing

if (a==1) {

} else if (a==2) {

} else if (a==3) {

} else…

but instead:

switch (a) {

1:

2:

3:

4:

…

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [December 14, 2025, 11:20pm UTC](https://forum.makecode.com/t/switch-statements/40933/2 "2025-12-14T23:20:30Z")

</div>

You could just put the tilemaps in an array and then they would all be in order with less code like you’re wishing for.

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [December 14, 2025, 11:21pm UTC](https://forum.makecode.com/t/switch-statements/40933/3 "2025-12-14T23:21:15Z")

</div>

Wait, that’s a thing?

---

<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:** [December 14, 2025, 11:23pm UTC](https://forum.makecode.com/t/switch-statements/40933/4 "2025-12-14T23:23:29Z")

</div>

Yup! Most C-style language have a `switch()` statement, JavaScript and TypeScript included. Useful … but not as widely used as it probably should be, perhaps because the syntax is a bit quirky.

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [December 15, 2025, 5:37pm UTC](https://forum.makecode.com/t/switch-statements/40933/5 "2025-12-15T17:37:06Z")

</div>

I’m my game that I’m making, each “case” has a tilemap and something to set the platform speed, player start, etc. that would make it harder to make an array

---

<div class="post-metadata">

**Author:** ![Rune](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rune/32/18951_2.png) [@Rune](https://forum.makecode.com/u/Rune)\
**Post date:** [December 16, 2025, 5:19am UTC](https://forum.makecode.com/t/switch-statements/40933/6 "2025-12-16T05:19:12Z")

</div>

I found out about switch when using Unreal Engine!

It would be _so_ useful for blocks.

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [January 5, 2026, 6:24pm UTC](https://forum.makecode.com/t/switch-statements/40933/7 "2026-01-05T18:24:13Z")

</div>

can makecode still add it? I would find it very useful to have
