# How to cancel assignment output in an if clause?

**URL:** <https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [November 21, 2020, 5:21pm UTC](https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544 "2020-11-21T17:21:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LuigiVampa](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@LuigiVampa](https://discourse.julialang.org/u/LuigiVampa)\
**Post date:** [November 21, 2020, 5:21pm UTC](https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544/1 "2020-11-21T17:21:47Z")

</div>

I know the semicolon at a=1; will cancel the output display at the REPL, but I get the output display 1 when I use the assignment in an if-clause:

if variable == check  
a=1;  
end

Sorry if this a very simple question, I am just starting out in Julia. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tomerarnon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomerarnon/32/3170_2.png) [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Post date:** [November 21, 2020, 5:30pm UTC](https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544/2 "2020-11-21T17:30:04Z")

</div>

Put the `;` after the `end`. Also applies to `if`, `let`, `begin`, etc  
That is indeed a weird edge case I run into sometimes as well!

---

<div class="post-metadata">

**Author:** ![LuigiVampa](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@LuigiVampa](https://discourse.julialang.org/u/LuigiVampa)\
**Post date:** [November 21, 2020, 5:32pm UTC](https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544/3 "2020-11-21T17:32:42Z")

</div>

Big thanks for the help and the speed!!

---

<div class="post-metadata">

**Author:** ![FedericoStra](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@FedericoStra](https://discourse.julialang.org/u/FedericoStra)\
**Post date:** [November 23, 2020, 10:58pm UTC](https://discourse.julialang.org/t/how-to-cancel-assignment-output-in-an-if-clause/50544/4 "2020-11-23T22:58:24Z")

</div>

> [@tomerarnon](#):
>
> That is indeed a weird edge case I run into sometimes as well!

It’s not _weird_ because `if` stetements are also expressions, hence return a value. For instance, you can write

```julia
a = if variable == check; 1 else 2 end

```

You can also omit the semicolon after the condition, but I think it aids readability.
