# Pluto: printing multiple statements in a for loop

**URL:** https://discourse.julialang.org/t/pluto-printing-multiple-statements-in-a-for-loop/73858
**Category:** General Usage
**Tags:** pluto, for-loop, statements
**Created:** [December 31, 2021, 11:47am UTC](https://discourse.julialang.org/t/pluto-printing-multiple-statements-in-a-for-loop/73858 "2021-12-31T11:47:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)
#### Post date: [December 31, 2021, 11:47am UTC](https://discourse.julialang.org/t/pluto-printing-multiple-statements-in-a-for-loop/73858/1 "2021-12-31T11:47:59Z")

</div>

Hi,

I have a simple `for` loop that involves printing multiple statements. This material is for teaching, so I want to keep it intuitive and straightforward. The code below works in VSCode and Jupyter, but I do not know how to make it work in Pluto. I looked carefully at issue [#245](https://github.com/fonsp/Pluto.jl/issues/245), but have not found a helpful way to overcome my problem. Some help would be very much appreciated.

MWE:

```julia
a = 0.75
b = -2.0
c = 1.0
tol = 1e-12
maxiter = 500
Fₙ = 0.0

for i = 1 : maxiter
    # Updating rule
    Fₙnew = -(1/(b + Fₙ * c)) * a
    # Stopping rule:
    if abs(a + b * Fₙnew + c * Fₙnew^2) < tol
        println("convergence after $i iterations")
        println("final value for F is $Fₙ")
        break
    end
    Fₙ = copy(Fₙnew)
    if i == maxiter
        println("No convergence after $i iterations")
    end
end

```

---

<div class="post-metadata">

### Author: ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)
#### Post date: [December 31, 2021, 3:16pm UTC](https://discourse.julialang.org/t/pluto-printing-multiple-statements-in-a-for-loop/73858/2 "2021-12-31T15:16:18Z")

</div>

Check the console. Pluto by default does not show print, you must use with\_terminal() for package PlutoUI. [Docstrings · PlutoUI.jl](https://docs.juliahub.com/PlutoUI/abXFp/0.7.9/autodocs/#PlutoUI.with_terminal-Tuple%7BFunction,%20Vararg%7BAny,%20N%7D%20where%20N)}

---

<div class="post-metadata">

### Author: ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)
#### Post date: [December 31, 2021, 4:15pm UTC](https://discourse.julialang.org/t/pluto-printing-multiple-statements-in-a-for-loop/73858/3 "2021-12-31T16:15:08Z")

</div>

@dmolina, thanks. I was doing a stupid mistake with the `with_terminal() do` option: I was keeping the `Print` function from Pluto in the loop, instead of using the native Julia `println`.

However, Pluto does accept by default the `println` stuff by using `Print`. In the example below, it prints the output; the annoying part is that it only prints the last one. If we have code that we used to run in VScode or Jupyter, it takes a certain amount of time to avoid stupid mistakes in the migration process.

![a](https://global.discourse-cdn.com/julialang/original/3X/1/8/18843e2ecef385648a3e554081ff8bb78fff60e5.png)
