# Multiple "checks" in one component possible?

**URL:** <https://cl.desmos.com/t/multiple-checks-in-one-component-possible/2265>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [December 27, 2020, 7:33pm UTC](https://cl.desmos.com/t/multiple-checks-in-one-component-possible/2265 "2020-12-27T19:33:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cheng\_Saechao](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cheng_saechao/32/1687_2.png) [@Cheng\_Saechao](https://cl.desmos.com/u/Cheng_Saechao)\
**Post date:** [December 27, 2020, 7:33pm UTC](https://cl.desmos.com/t/multiple-checks-in-one-component-possible/2265/1 "2020-12-27T19:33:07Z")

</div>

Is there a way to do multiple “checks” for multiple variables in ONE component? I’ve only been doing one per component. I use these in grade calculations at the end.

“check = when isCorrect2 1  
otherwise 0.5”

Here’s the Activity:

> **[Defining & Adding Variables of graph • Activity by Cheng Saechao](https://classroom.amplify.com/activity/5fe0f016fea37c0d2b3cc249)**
>
> Scores the input and check variables in score component, NOT within the input boxes themselves. Time saver for entering code/making changes. Watch out for quotations vs backwards single quote because then I doesn't read the condition to set it to...

---

<div class="post-metadata">

**Author:** ![Susan\_Lauer](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/susan_lauer/32/1832_2.png) [@Susan\_Lauer](https://cl.desmos.com/u/Susan_Lauer)\
**Post date:** [December 27, 2020, 8:48pm UTC](https://cl.desmos.com/t/multiple-checks-in-one-component-possible/2265/2 "2020-12-27T20:48:47Z")

</div>

Your activity gave me some wonderful ideas for organizing work. Thank you!

Check is a variable you’re creating, so it can really be called anything. You can remove all references for all checks in all other components and put this in your component on page 4:

readOnly: true  
#SUMMING POINTS  
pointsEarned = numericValue(`${this.script.checkiA} + ${this.script.checkiB} + ${this.script.checkiC} + ${this.script.checkgraph1X} + ${this.script.checkgraph1C_C} + ${this.script.checkgraph1A_C}`)  
pointsPossible = 8

percentScore = numericValue(`\operatorname{round}\left(100*${pointsEarned}/${pointsPossible},1\right)`)

cellContent(1,1): `${pointsEarned}`  
cellContent(1,2): `${pointsPossible}`  
cellContent(1,3): `${percentScore}`

checkiA = when iA.latex = “x=-1” 5 # key & points worth here  
when iA.latex = “x=” 0 # note QUOTATION for this one, key & points worth here  
otherwise 2.5 #BECAREFUL I’ve accidentally used Capital X instead of lowercase x and “when” can’t distinguish.  
checkiB = when iB.latex = `(-1,-8)` 5 # key & points worth here  
when iB.latex = “(,)” 0 # note QUOTATION for this one, key & points worth here  
otherwise 2.5  
checkiC = when iC.latex = `(0,-6)` 5 # key & points worth here  
when iC.latex = “(0,)” 0 # note QUOTATION for this one, key & points worth here  
otherwise 2.5  
checkgraph1X = when graph1.number(“X”)=1 1 #like a nested if statement. Do I only need ONE otherwise?  
otherwise 0.5 #BE  
checkgraph1C\_C = when graph1.number(“C\_C”)=1 1  
otherwise 0.5  
checkgraph1A\_C = when graph1.number(“A\_C”)=1 1 #like a nested if statement. Do I only need ONE otherwise?  
otherwise 0.5 #BE

---

<div class="post-metadata">

**Author:** ![Cheng\_Saechao](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cheng_saechao/32/1687_2.png) [@Cheng\_Saechao](https://cl.desmos.com/u/Cheng_Saechao)\
**Post date:** [December 28, 2020, 7:17pm UTC](https://cl.desmos.com/t/multiple-checks-in-one-component-possible/2265/3 "2020-12-28T19:17:31Z")

</div>

Thank you very much. You’re very thorough and concise. Have a nice Holiday.
