# Is there a way to access a value of a variable in the previous steptime?

**URL:** https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867
**Category:** Modelling & Simulations
**Created:** [May 15, 2023, 9:34am UTC](https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867 "2023-05-15T09:34:35Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![HamzaKh99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hamzakh99/32/49279_2.png) [@HamzaKh99](https://discourse.julialang.org/u/HamzaKh99)
#### Post date: [May 15, 2023, 9:34am UTC](https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867/1 "2023-05-15T09:34:35Z")

</div>

Hello!  
I’m trying to access the value of a variable in the previous step time to use it afterward, I’m using discrete\_events() for that, but is there a simple way to do it?

---

<div class="post-metadata">

### Author: ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)
#### Post date: [May 15, 2023, 3:38pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867/2 "2023-05-15T15:38:40Z")

</div>

It sounds like you might be solving a Delay Differential Equation:

[https://docs.sciml.ai/DiffEqDocs/stable/tutorials/dde\_example/](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/dde_example/)

Hopefully something there is helpful.
