# Checking for correctness - 2 questions on 1 screen

**URL:** <https://cl.desmos.com/t/checking-for-correctness-2-questions-on-1-screen/1666>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [October 9, 2020, 8:29am UTC](https://cl.desmos.com/t/checking-for-correctness-2-questions-on-1-screen/1666 "2020-10-09T08:29:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maor](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/maor/32/9343_2.png) [@maor](https://cl.desmos.com/u/maor)\
**Post date:** [October 9, 2020, 8:29am UTC](https://cl.desmos.com/t/checking-for-correctness-2-questions-on-1-screen/1666/1 "2020-10-09T08:29:28Z")

</div>

Please help, can’t find the bug!  
I made a screen with two questions in a row (part of an escape room, so it’s importent to me it’ll be in the same screen). I have two math input boxes for the two questions and an action button to change the question.  
After much trial and error, I defined a parameter ‘correct’ in the first math input, set to 1 when first q is correct, 2 when second is correct and 0 otherwise. for some reason, it dosen’t change to 2 when the second is correct, and I can’t figure out what I did wrong.  
Help anyone?

[https://teacher.desmos.com/activitybuilder/custom/5f801a7287c71732cf9927d3](https://teacher.desmos.com/activitybuilder/custom/5f801a7287c71732cf9927d3)

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [October 9, 2020, 3:54pm UTC](https://cl.desmos.com/t/checking-for-correctness-2-questions-on-1-screen/1666/2 "2020-10-09T15:54:16Z")

</div>

It’s just the order of the `when`'s. If you have a when-when-otherwise, it checks the first then the second then the otherwise. If the conditions for the first when are met, it stops. So in your code it will never get to assigning correct=2. Switch the first two and it should be okay.

Also, you don’t need to use `this.script.correct`, you can just use `correct` since the variable is in that component.

---

<div class="post-metadata">

**Author:** ![maor](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/maor/32/9343_2.png) [@maor](https://cl.desmos.com/u/maor)\
**Post date:** [October 10, 2020, 9:33pm UTC](https://cl.desmos.com/t/checking-for-correctness-2-questions-on-1-screen/1666/3 "2020-10-10T21:33:55Z")

</div>

Thanks, that did it. And also for the tip!
