# How to hide an inner output in the REPL?

**URL:** <https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782>\
**Category:** General Usage\
**Tags:** repl\
**Created:** [September 7, 2021, 12:49am UTC](https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782 "2021-09-07T00:49:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 7, 2021, 12:49am UTC](https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782/1 "2021-09-07T00:49:59Z")

</div>

I have a code (simplified as in the below code) put in a file. When I run it, an output of the “W” matrix is automatically displayed in the REPL after the execution of the code, although all the assignment are ended by “;”. I dont want this display to happen. Any solution for that?

```julia
using SparseArrays
Base.@kwdef mutable struct RLCs
    SS::Vector{Float64} = [0,0,0]
end
RLC = RLCs[];
for i in 1:3
push!(RLC, RLCs([1,2,3]));
end
function KK(RLC::Vector{RLCs})
   dt=5;
  W= spzeros(size(RLC,2),size(RLC,2));
    for i in eachindex(RLC)
          W[i,i] = RLC[i].SS[1];
    end
      W; 
end
RR = KK(RLC);

```

``julia  
3×3 SparseMatrixCSC{Float64, Int64} with 12 stored entries:  
0.002501 ⋅ ⋅ -1.0e-6 ⋅ ⋅  
⋅ 0.002501 ⋅ ⋅ -1.0e-6 ⋅  
⋅ ⋅ 0.002501 ⋅ ⋅ -1.0e-6

```julia

```

---

<div class="post-metadata">

**Author:** ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Post date:** [September 7, 2021, 1:02am UTC](https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782/2 "2021-09-07T01:02:56Z")

</div>

You don’t need to place `;`'s on inner lines, only on the REPL line if you want to suppress output.

Your example doesn’t work for me though.  
I suspect you may be calling some previously compiled function that had a `display` or something similar.  
Have you tried your code in a new session?

```julia
julia> using SparseArrays

julia> Base.@kwdef mutable struct RLCs
           SS::Vector{Float64} = [0,0,0]
       end
RLCs

julia> RLC = RLCs[];

julia> for i in 1:3
       push!(RLC, RLCs([1,2,3]))
       end

julia> function KK(RLC::Vector{RLCs})
           dt = 5
           W = spzeros(size(RLC,2),size(RLC,2))
           for i in eachindex(RLC)
               W[i,i] = RLC[i].SS[1]
           end
           W 
       end
KK (generic function with 1 method)

julia> RR = KK(RLC);
ERROR: BoundsError: attempt to access 1×1 SparseMatrixCSC{Float64, Int64} at index [2, 2]
Stacktrace:
 [1] _setindex_scalar!(A::SparseMatrixCSC{Float64, Int64}, _v::Float64, _i::Int64, _j::Int64)
   @ SparseArrays /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:2581
 [2] setindex!
   @ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:2574 [inlined]
 [3] KK(RLC::Vector{RLCs})
   @ Main ./REPL[12]:5
 [4] top-level scope
   @ REPL[13]:1

```

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [September 7, 2021, 1:30am UTC](https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782/3 "2021-09-07T01:30:43Z")

</div>

> [@Amro](#):
>
> ```julia
> function KK(RLC::Vector{RLCs})
> dt=5;
> W= spzeros(size(RLC,2),size(RLC,2));
> for i in eachindex(RLC)
> W[i,i] = RLC[i].SS[1];
> end
> W; 
> end
> 
> ```

I am sorry the there is one mistake in the below function, that’s why it return errors.

```julia
function KK(RLC::Vector{RLCs})
   dt=5;
  W= spzeros(size(RLC,1),size(RLC,1));
    for i in eachindex(RLC)
          W[i,i] = RLC[i].SS[1];
    end
      W; 
end

```

Yes, I have tried my code in a new session, but still displaying the unwanted “W” matrix

---

<div class="post-metadata">

**Author:** ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Post date:** [September 7, 2021, 1:37am UTC](https://discourse.julialang.org/t/how-to-hide-an-inner-output-in-the-repl/67782/4 "2021-09-07T01:37:09Z")

</div>

I get no output. Are you running this in an IDE?  
I ran this directly in the julia 1.6.2 terminal

```julia
julia> using SparseArrays

julia> Base.@kwdef mutable struct RLCs
           SS::Vector{Float64} = [0,0,0]
       end
RLCs

julia> RLC = RLCs[];

julia> for i in 1:3
       push!(RLC, RLCs([1,2,3]))
       end

julia> function KK(RLC::Vector{RLCs})
          dt=5;
         W= spzeros(size(RLC,1),size(RLC,1));
           for i in eachindex(RLC)
                 W[i,i] = RLC[i].SS[1];
           end
             W; 
       end
KK (generic function with 1 method)

julia> RR = KK(RLC);

julia> 

```
