# Can't the key be detected in the loop?

**URL:** <https://forum.makecode.com/t/cant-the-key-be-detected-in-the-loop/9354>\
**Category:** Arcade\
**Created:** [July 23, 2021, 4:57pm UTC](https://forum.makecode.com/t/cant-the-key-be-detected-in-the-loop/9354 "2021-07-23T16:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunkka](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@kunkka](https://forum.makecode.com/u/kunkka)\
**Post date:** [July 23, 2021, 4:57pm UTC](https://forum.makecode.com/t/cant-the-key-be-detected-in-the-loop/9354/1 "2021-07-23T16:57:53Z")

</div>

![QQ图片20210723085434](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/ca21f9984aeee5e3fe3f318b85805f6b0b2bdb96.png)  
I cant print “break”

---

<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:** [July 23, 2021, 9:06pm UTC](https://forum.makecode.com/t/cant-the-key-be-detected-in-the-loop/9354/2 "2021-07-23T21:06:28Z")

</div>

Try putting a `pause(0)` in the while loop at the very end. So instead of:

```nohighlight
while <true> do:
    if B button pressed:
        break

```

Do:

```nohighlight
while <true> do:
    if B button pressed:
        break
    pause for 0 ms

```

---

<div class="post-metadata">

**Author:** ![kunkka](https://avatars.discourse-cdn.com/v4/letter/k/eada6e/32.png) [@kunkka](https://forum.makecode.com/u/kunkka)\
**Post date:** [July 26, 2021, 3:42pm UTC](https://forum.makecode.com/t/cant-the-key-be-detected-in-the-loop/9354/3 "2021-07-26T15:42:07Z")

</div>

Thank you very much. This code works
