How to cancel assignment output in an if clause?

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

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

1 Like

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!


Big thanks for the help and the speed!!

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

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

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