# Equivalent of Python if \_\_debug\_\_

**URL:** <https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715>\
**Category:** General Usage\
**Created:** [June 26, 2019, 9:46am UTC](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715 "2019-06-26T09:46:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [June 26, 2019, 9:46am UTC](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715/1 "2019-06-26T09:46:20Z")

</div>

In Python there is a feature for simple print style debugging to be switched on or off.  
If you run a Python script with the -O option then

```nohighlight
if __debug__ :
      print variable, variable, variable

```

Is there an equivalent in Julia? I know you could set a constant to be true or false, bt that involves editing the code to switch on/off the debug lines.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [June 26, 2019, 9:51am UTC](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715/2 "2019-06-26T09:51:31Z")

</div>

See [Logging · The Julia Language](https://docs.julialang.org/en/v1.1/stdlib/Logging/#Environment-variables-1).

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [June 26, 2019, 5:33pm UTC](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715/3 "2019-06-26T17:33:12Z")

</div>

This may interest you too: [@assert alternatives?](https://discourse.julialang.org/t/assert-alternatives/24775)

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [June 26, 2019, 5:46pm UTC](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715/4 "2019-06-26T17:46:57Z")

</div>

Thankyou both
