# Why is this printing to REPL?

**URL:** https://discourse.julialang.org/t/why-is-this-printing-to-repl/15981
**Category:** New to Julia
**Created:** [October 6, 2018, 10:25pm UTC](https://discourse.julialang.org/t/why-is-this-printing-to-repl/15981 "2018-10-06T22:25:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)
#### Post date: [October 6, 2018, 10:25pm UTC](https://discourse.julialang.org/t/why-is-this-printing-to-repl/15981/1 "2018-10-06T22:25:36Z")

</div>

Sorry, new to Julia (from Matlab),

If I copy + paste this into the REPL (Julia v1.0.0), no output is printed:

```julia
N = 1024;
A = rand(Float64,N,N);
B = rand(Float64,N,N);
ii = 2:N-1;
jj = 2:N-1;
J = zeros(Float64,N,N);
@time @views J[jj,ii] .= A[jj.+1,ii.-1] .- B[jj.-1,ii.+1];

```

But if I save to a file run via include:

```julia
include("C:/my/path/to/why.jl")

```

It prints the following:

```julia
1022×1022 view(::Array{Float64,2}, 2:1023, 2:1023) with eltype Float64:

```

followed by the contents of the array.

If I put a semicolon after the include statement, e.g. `include();`, nothing is printed, but it’s not clear to me whether this is expected behavior – I have semicolons everywhere in the included file, so why is anything being printed? Is this negatively affecting performance, even with the `include();` version?

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [October 6, 2018, 10:39pm UTC](https://discourse.julialang.org/t/why-is-this-printing-to-repl/15981/2 "2018-10-06T22:39:13Z")

</div>

> [@GregVernon](#):
>
> N = 1024;

The only place where values get printed automatically when not followed by a `;` is the REPL (or things that are similar to the REPL like IJulia notebook). This is totally different from the matlab behavior that IMO doesn’t make any sense from a programing language POV and extremely annoy in practice.

This means that the `;` in your script is having no effect what so ever on the REPL printing, only what you type in the REPL does. You didn’t have the `;` on the `include` so whatever `include` returns will be printed.

> [@GregVernon](#):
>
> whether this is expected behavior

Yes.

> [@GregVernon](#):
>
> I have semicolons everywhere in the included file

Which have no effect at all.

> [@GregVernon](#):
>
> so why is anything being printed?

Because it’s the return value of the `include` that’s printed, which is the value of the last expression in the file.

> [@GregVernon](#):
>
> Is this negatively affecting performance, even with the `include();` version?

No. This is purely a REPL statement behavior and has nothing to do with the behavior and therefore the performance anywhere else.

---

<div class="post-metadata">

### Author: ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)
#### Post date: [October 6, 2018, 11:14pm UTC](https://discourse.julialang.org/t/why-is-this-printing-to-repl/15981/3 "2018-10-06T23:14:49Z")

</div>

Thank you.
