Break the (random) endless loop in a fast playing field

while playing on a fast playground (what’s called), I accidentally entered an endless loop, such as this one:

var l = 3
while (l > 2) {
  println(l)
  l++
}

this causes the playground to print endlessly on the console on which Xcode is stuck

The only way I found is to kill Xcode through the terminal window, however, I would expect that there is an even more elegant way to “stop” the playground from being executed?

+4
source share
3 answers

, , . , , for while.

, , , . . , , Playground .

, :

for var j=0;j<10000000;j=j+1000 {

:

for var j=0;j<10000000;j=j+1000 { adsklfasd

:

for var j=0;j<500;j=j+10 { adsklfasd

, :

for var j=0;j<500;j=j+10 {

, adsklfasd .

for; , .

, . , .

+5

, ( ) - , , , .

l = 0 , .

0

Xcode 8.3.3. .

While the playground is running, the source code is still editable. Just change the loop, enter a command, such as break into the code, inside the loop. This is interpreted code, not compiled code, for it to take effect.

0
source

All Articles