# How do you detect your enum input?

**URL:** <https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479>\
**Category:** Help\
**Tags:** extension\
**Created:** [August 20, 2026, 2:34am UTC](https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479 "2026-08-20T02:34:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cybercube](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cybercube/32/34628_2.png) [@Cybercube](https://forum.makecode.com/u/Cybercube)\
**Post date:** [August 20, 2026, 2:34am UTC](https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479/1 "2026-08-20T02:34:35Z")

</div>

So, I’m making a block that have Enum’s in it, but how do you detect what type of Enum choices do a script

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [August 20, 2026, 4:35pm UTC](https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479/2 "2026-08-20T16:35:36Z")

</div>

I’m pretty sure it uses a number.

---

<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:** [August 20, 2026, 4:45pm UTC](https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479/3 "2026-08-20T16:45:08Z")

</div>

I think the best way is using `switch` and `case` like this:

```typescript
enum GameState {
    Intro,
    Menu,
    Playing,
    Cutscene
}
let gameState = GameState.Intro

game.onUpdate(function () {
    switch(gameState) {
        case GameState.Intro:
            ...
            break
        case GameState.Menu:
            ...
            break
        case GameState.Playing:
            ...
            break
        case GameState.Cutscene:
            ...
            break
    }
})

```

---

<div class="post-metadata">

**Author:** ![Cybercube](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cybercube/32/34628_2.png) [@Cybercube](https://forum.makecode.com/u/Cybercube)\
**Post date:** [August 20, 2026, 10:04pm UTC](https://forum.makecode.com/t/how-do-you-detect-your-enum-input/45479/4 "2026-08-20T22:04:35Z")

</div>

thank you!
