# Make a variable as a global variable within a function

**URL:** <https://discourse.julialang.org/t/make-a-variable-as-a-global-variable-within-a-function/63067>\
**Category:** New to Julia\
**Tags:** macros\
**Created:** [June 17, 2021, 6:29am UTC](https://discourse.julialang.org/t/make-a-variable-as-a-global-variable-within-a-function/63067 "2021-06-17T06:29:58Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![iHany](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihany/32/18151_2.png) [@iHany](https://discourse.julialang.org/u/iHany)\
**Post date:** [June 18, 2021, 2:17am UTC](https://discourse.julialang.org/t/make-a-variable-as-a-global-variable-within-a-function/63067/21 "2021-06-18T02:17:38Z")

</div>

@jonniedie , as you’re a very nice developer for simulation in Julia, I leave you a message:

I implemented the logging mechanism based on SavingCallback in [FlightSims.jl](https://github.com/JinraeKim/FlightSims.jl) (See #77 or current `master` branch).  
It may have potential error though.

Note that this package may be bit untidy 'cause it’s dedicated for my team until now 🙂 .

EDIT: nested logging can be found in [test/nested\_envs.jl](https://github.com/JinraeKim/FlightSims.jl/blob/master/test/nested_envs.jl).

---

<div class="post-metadata">

**Author:** ![jonniedie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonniedie/32/12842_2.png) [@jonniedie](https://discourse.julialang.org/u/jonniedie)\
**Post date:** [June 18, 2021, 3:29pm UTC](https://discourse.julialang.org/t/make-a-variable-as-a-global-variable-within-a-function/63067/22 "2021-06-18T15:29:14Z")

</div>

Thanks @iHany. I check it out. Doing it that way makes a lot of sense. The only thing it would be missing is the ability to interpolate between time steps after the fact. But that’s not necessarily a deal breaker. Maybe an option to choose between the two styles would be nice too.

[Previous page](https://discourse.julialang.org/t/make-a-variable-as-a-global-variable-within-a-function/63067.md?page=1)
