# Writing an equation of a line

**URL:** <https://cl.desmos.com/t/writing-an-equation-of-a-line/2243>\
**Category:** Questions\
**Created:** [December 18, 2020, 5:40pm UTC](https://cl.desmos.com/t/writing-an-equation-of-a-line/2243 "2020-12-18T17:40:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amy\_Olson](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/amy_olson/32/1483_2.png) [@Amy\_Olson](https://cl.desmos.com/u/Amy_Olson)\
**Post date:** [December 18, 2020, 5:40pm UTC](https://cl.desmos.com/t/writing-an-equation-of-a-line/2243/1 "2020-12-18T17:40:01Z")

</div>

I am trying to get students to write an equation of a line and after they submit their answer I want it to say “correct” or “try again”. I am struggling with the code.  
This is what I have so far:

correct: Answer1.latex = “y=-2x+15”

content:  
when Answer1.submitted and correct “Correct” otherwise “Try again”

Any help is greatly appriciated

---

<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:** [December 18, 2020, 5:58pm UTC](https://cl.desmos.com/t/writing-an-equation-of-a-line/2243/2 "2020-12-18T17:58:41Z")

</div>

While matching latex is not the most recommended method of checking, using backticks (to the left of the 1 key) instead of quotes will increase the likelihood of it working. Also, you can use “this” instead of a component name if you are in that component’s CL.

`correct: this.latex=`y=-2x+15` `

---

<div class="post-metadata">

**Author:** ![Amy\_Olson](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/amy_olson/32/1483_2.png) [@Amy\_Olson](https://cl.desmos.com/u/Amy_Olson)\
**Post date:** [December 18, 2020, 6:45pm UTC](https://cl.desmos.com/t/writing-an-equation-of-a-line/2243/3 "2020-12-18T18:45:28Z")

</div>

Thanks!  
Any idea how to make it tell the student their answer is correct or not correct?

---

<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:** [December 18, 2020, 7:46pm UTC](https://cl.desmos.com/t/writing-an-equation-of-a-line/2243/4 "2020-12-18T19:46:58Z")

</div>

You can’t access a `correct:` sink, but you can use variables. Altering your original, I usually do something like this (I like all answer checking in the component where students give answers or a graph if numerous calculations are needed.):

In input CL:

```auto
check= this.latex = `y=-2x+15`
correct: check

```

In your note CL (with some common tricks for giving feedback in the same note as your question or directions):

```auto
feedback= when not(Answer1.submitted) ""
          when check "Correct"
          otherwise "Try again."
content:
"Your instructions here.

${feedback}"

```
