# Using @warn like @assert?

**URL:** <https://discourse.julialang.org/t/using-warn-like-assert/57545>\
**Category:** General Usage\
**Created:** [March 19, 2021, 2:51pm UTC](https://discourse.julialang.org/t/using-warn-like-assert/57545 "2021-03-19T14:51:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![markmbaum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/markmbaum/32/32745_2.png) [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Post date:** [March 19, 2021, 2:51pm UTC](https://discourse.julialang.org/t/using-warn-like-assert/57545/1 "2021-03-19T14:51:36Z")

</div>

Short question! Is there a way to conditionally produce a warning without writing the `if-end` block? It would look like

```julia
@warn x < y "you should know that x is less than y"

```

similar to the way that `@assert` works.

---

<div class="post-metadata">

**Author:** ![simeonschaub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simeonschaub/32/216566_2.png) [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Post date:** [March 19, 2021, 2:56pm UTC](https://discourse.julialang.org/t/using-warn-like-assert/57545/2 "2021-03-19T14:56:28Z")

</div>

You can use `&&` or `||` for this instead:

```julia
x < y && @warn "you should know that x is less than y"

```
