# Slope Expressed as A Fraction

**URL:** <https://cl.desmos.com/t/slope-expressed-as-a-fraction/3864>\
**Category:** Questions\
**Created:** [December 1, 2021, 1:51am UTC](https://cl.desmos.com/t/slope-expressed-as-a-fraction/3864 "2021-12-01T01:51:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmanaligod](https://avatars.discourse-cdn.com/v4/letter/h/ba9def/32.png) [@hmanaligod](https://cl.desmos.com/u/hmanaligod)\
**Post date:** [December 1, 2021, 1:51am UTC](https://cl.desmos.com/t/slope-expressed-as-a-fraction/3864/1 "2021-12-01T01:51:39Z")

</div>

Hi everyone. Here is an activity that I am trying to tweak.

> **[Slope and Slope-Intercept Practice • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/61a6d392bc4bf9595240fe75)**
>
> Infinite practice for linear functions.

In the 2nd slide, there is a variable that is defined ${graph1.number(“s\_{lope}”)}. It is displayed as a decimal in the note component on the top right. Is it possible for this number to be displayed as a fraction by default?

Thanks as always for the help.

---

<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 1, 2021, 6:37pm UTC](https://cl.desmos.com/t/slope-expressed-as-a-fraction/3864/2 "2021-12-01T18:37:14Z")

</div>

CL that pulls values will only take the decimal value. If you want it as a fraction, you’ll need the numerator and denominator defined in the graph and format in the note:

```auto
`\frac{${graph1.number(`n`)}{${graph1.number(`d`)}}`

```

You may want to define your fraction using a when-otherwise to conditionally display as an integer:

```auto
myFrac= when graph1.number(`d`)=1 "`${graph1.number(`n`)}`"
               otherwise "`\frac{${graph1.number(`n`)}{${graph1.number(`d`)}}`"
content: "...The slope is ${myFrac}."

```
