# Interrupting while loops in VSCode

**URL:** <https://discourse.julialang.org/t/interrupting-while-loops-in-vscode/34083>\
**Category:** Tooling\
**Tags:** first-steps, vscode\
**Created:** [February 2, 2020, 2:23pm UTC](https://discourse.julialang.org/t/interrupting-while-loops-in-vscode/34083 "2020-02-02T14:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drhouse82](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drhouse82/32/9806_2.png) [@drhouse82](https://discourse.julialang.org/u/drhouse82)\
**Post date:** [February 2, 2020, 2:23pm UTC](https://discourse.julialang.org/t/interrupting-while-loops-in-vscode/34083/1 "2020-02-02T14:23:30Z")

</div>

I’m confused by the behaviour of breaking while loops in VSCode when either using REPL only or running a script from a file.

Code:

```julia
while true
    println("foo")
    sleep(1)
end

```

If I type this into the VSCode REPL then I can easily interrupt the loop by pressing Ctrl+C.  
(EDIT: I previously wrote that running and breaking the script from commandline would work. That’s not true, there I get EXCEPTION\_ACCESS\_VIOLATION)

In contrast, if I run the script in VSCode by pressing F5 and I try to interrupt the loop, I get back a working julia REPL prompt (“julia\>”), but the periodic foo-printing continues (like from a background task).

This is maybe a minor thing, but quite annoying if you have to restart julia every time you want to adjust your loop-code slightly. (compilation time, etc.)

Is there any other way to interrupt code in VSCode?  
Where is the difference actually coming from?

Windows 10, VSCode 1.41.1, julia plugin 0.13.1, Julia 1.3.0.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [February 2, 2020, 6:26pm UTC](https://discourse.julialang.org/t/interrupting-while-loops-in-vscode/34083/2 "2020-02-02T18:26:04Z")

</div>

Could you open an issue on github for this? This is something we need to fix, just not sure yet how…

---

<div class="post-metadata">

**Author:** ![drhouse82](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drhouse82/32/9806_2.png) [@drhouse82](https://discourse.julialang.org/u/drhouse82)\
**Post date:** [February 2, 2020, 10:14pm UTC](https://discourse.julialang.org/t/interrupting-while-loops-in-vscode/34083/3 "2020-02-02T22:14:17Z")

</div>

OK, done.  
[https://github.com/julia-vscode/julia-vscode/issues/969](https://github.com/julia-vscode/julia-vscode/issues/969)  
Thanks
