Infinite Loop Excecution

Problem description: When I writing some infinite loop code then code is being continuously running I don’t know how to stop the code

Expected behavior: I want to stop the code in the middle of running the code.

**Actual behavior:But I can’t stop it even I can’t edit.

Steps to reproduce:

**Bug appears at this link:https://replit.com/@SoumitraSharma2001/Practise-1#script.js

Browser/OS/Device:

Hey @SoumitraSharma2001, welcome to the forums!

Thank you for your post and sorry that you are experiencing issues. However the Replit support team may not be able to help you with this issue if you do not complete the template fields fully.

Without knowing the expected and actual behavior (screenshots are fine for this section) as well as the link to your Repl and the steps a member of the support team will need to follow to reproduce the error there won’t be much we can do to help you.

The more information you provide at the start, the easier it will be to identify if your bug report is an issue or a misunderstanding.

But based on the limited information, it seems that your problem is not a bug. We cannot suggest you a fix unless you say the language you are programming in.

I have temporarily moved this topic into #code-help.

1 Like

Hello @SoumitraSharma2001 , Welcome To The Community

Use if Condition With break To Stop The Loop In Middle Of Running The Code

Ex.

while (true){
  let b = 120
  let a = prompt("Enter the number")
  //alert(a)
  if(a == b){
    alert('You Win')
    break
  }
  alert('Wrong Number')
}

Note :- I Don’t Know English And JS So Much :smiling_face_with_tear:

Why are you doing an infinite loop?

Actually if by chance any person forgot to put break statement in the infinite loop and runs it directly so you won’t be able to edit your program at replit

Refresh the page, it will probably tell you the code hasn’t saved, just ignore that, if you don’t want to ignore it, copy all the code in the current file before refreshing.