# Redefining a function on the fly

**URL:** https://discourse.julialang.org/t/redefining-a-function-on-the-fly/19815
**Category:** General Usage
**Created:** [January 19, 2019, 2:42pm UTC](https://discourse.julialang.org/t/redefining-a-function-on-the-fly/19815 "2019-01-19T14:42:41Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [January 19, 2019, 3:33pm UTC](https://discourse.julialang.org/t/redefining-a-function-on-the-fly/19815/3 "2019-01-19T15:33:37Z")

</div>

It would be more idiomatic to make the function behavior conditional on something that you can change — can be a parameter, a shared variable (if you are using threads), or something you read from a file. The implementation of how you propose to do

> [@lucaregini](#):
>
> Change the definition of omy while test is still running

is crucial. Also, perhaps you could give more context: what is it you are trying to do?

Finally, please quote your code.

> [@PSA: how to quote code with backticks](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530):
>
> This is a short post on how to use backticks (` and ```) to quote code, so it is easy to read. This post can be linked to new users who are confused by this feature. Why By quoting your code, you get a monospaced font (which preserves indentation) and syntax highlighting. This makes it easier to read your code and help you. Displayed code looks like this: function displayed\_code(x::Int, y::Int) if x \< y println("x is smaller") else println("or not") end end Inline…

---

_[View the full topic](https://discourse.julialang.org/t/redefining-a-function-on-the-fly/19815)._
