# Use action button to create points

**URL:** <https://cl.desmos.com/t/use-action-button-to-create-points/943>\
**Category:** Questions\
**Created:** [May 2, 2020, 2:12am UTC](https://cl.desmos.com/t/use-action-button-to-create-points/943 "2020-05-02T02:12:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbj](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sbj/32/746_2.png) [@sbj](https://cl.desmos.com/u/sbj)\
**Post date:** [May 2, 2020, 2:12am UTC](https://cl.desmos.com/t/use-action-button-to-create-points/943/1 "2020-05-02T02:12:49Z")

</div>

Hello,

I’m brand new to CL (I just learned about it this week). I’m trying to create an action button that adds points to the line y=2x when pressed. I’ve been able to get it to plot random points on that line using the following code:

r = randomGenerator(btn1.pressCount)

number(“c”): r.float(-3,3)

And my graph has the following point:

(c, c\*2)

However, every time I press the action button, the old point goes away and a new point appears. I would like the old point to stay and a new point appear. In other words, as I press the button more, the line starts to fill out.

Is this possible?

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [May 2, 2020, 3:08am UTC](https://cl.desmos.com/t/use-action-button-to-create-points/943/2 "2020-05-02T03:08:14Z")

</div>

You can capture the history of the random numbers. Add these things to what you already have:

**Graph**

```auto
numberList("C"): btn1.history("C")

```

**Button**

```auto
capture("C"): graph.number("c")

```

Then create a new point in the graphing calculator of (C, 2C).

---

<div class="post-metadata">

**Author:** ![sbj](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sbj/32/746_2.png) [@sbj](https://cl.desmos.com/u/sbj)\
**Post date:** [May 2, 2020, 3:30am UTC](https://cl.desmos.com/t/use-action-button-to-create-points/943/3 "2020-05-02T03:30:21Z")

</div>

> [@cwinske](#):
>
> capture(“C”): graph.number(“c”)

That worked perfectly! Thank you.

I love how much the computation layer allows you to do. But, its also a lot to learn 🙂
