# Help! why is this giving me an error?

**URL:** <https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750>\
**Category:** micro:bit\
**Tags:** game\
**Created:** [March 20, 2025, 1:50pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750 "2025-03-20T13:50:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AD1340](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ad1340/32/20625_2.png) [@AD1340](https://forum.makecode.com/u/AD1340)\
**Post date:** [March 20, 2025, 1:50pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/1 "2025-03-20T13:50:04Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/5/a5d230b53b43294d626d368a2e48220bb4be6bad.png)  
WHY WONT IT WORK???

---

<div class="post-metadata">

**Author:** ![AgentBoom](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agentboom/32/16635_2.png) [@AgentBoom](https://forum.makecode.com/u/AgentBoom)\
**Post date:** [March 20, 2025, 8:56pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/2 "2025-03-20T20:56:11Z")

</div>

You see, the little " " symbols in the white space (in the if statement) where you put the number mean that it is for TEXT input. You put a number in there when you should have put text.  
 ![Screenshot 2025-03-20 14.38.30](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/3/f33715f9d5c6752cfb6469ba67ba2ac560a956b9.png)  
This is the IF block that you’re looking for.

---

<div class="post-metadata">

**Author:** ![BotWarrior](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/botwarrior/32/25328_2.png) [@BotWarrior](https://forum.makecode.com/u/BotWarrior)\
**Post date:** [March 20, 2025, 8:57pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/3 "2025-03-20T20:57:39Z")

</div>

That is inside a string, and tggg is a number. Look at this bit.  
 ![Screenshot 2025-03-21 at 07.34.10](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/e/b/eb78a473d7b0888f300cd19a0f26c328e850be1f.png)  
Notice a difference between them? One has quotes, drag a math block with the number 0 in it and nothing else into the “2” spot.

---

<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:** [March 20, 2025, 9:00pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/4 "2025-03-20T21:00:45Z")

</div>

Your putting a number value and a text value in the same comparison Boolean.  
Swap out the text value with a number value and it  
_should_  
work.  
(The rightmost value)

---

<div class="post-metadata">

**Author:** ![Gl125371](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gl125371/32/29131_2.png) [@Gl125371](https://forum.makecode.com/u/Gl125371)\
**Post date:** [March 20, 2025, 9:01pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/5 "2025-03-20T21:01:21Z")

</div>

Hi, it is not working because tggg is a number, and in the if loop, you are comparing it with a string. To know if you are comparing against a string or a number, look at this picture:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/5/a5d1876ffabf7262f43220f691c00175a6e1b06f.png)

---

<div class="post-metadata">

**Author:** ![raster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/raster/32/3382_2.png) [@raster](https://forum.makecode.com/u/raster)\
**Post date:** [March 20, 2025, 9:04pm UTC](https://forum.makecode.com/t/help-why-is-this-giving-me-an-error/34750/6 "2025-03-20T21:04:03Z")

</div>

You are trying to compare a “number” (tggg) to a string (“2”)

The quotes around the “2” make it a string… can you remove the quotes so 2 is recognized as a number?

 ![Screenshot 2025-03-20 at 2.52.54 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/2/4227c28bfaca3dd18075a2a37bca9d352b4ef01f.png)
