# Ending a for loop without using "||" in the condition

**URL:** <https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552>\
**Category:** Uncategorized\
**Created:** [April 6, 2004, 10:05pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552 "2004-04-06T22:05:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)\
**Post date:** [April 6, 2004, 10:05pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552/1 "2004-04-06T22:05:47Z")

</div>

how can i exit a for loop without using an OR logic test in the condition  
when i try this, it comes up saying “this movie is running a script that is causing the computer to run slowly etc… stop script?” - or something to that effect.

thanks

cA

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 10:28pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552/2 "2004-04-06T22:28:52Z")

</div>

You’d use the [font=courier new]break[/font] statement. What’s your code?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 10:58pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552/3 "2004-04-06T22:58:59Z")

</div>

hm, my computer crashed. i hate it when that happens, can’t be bothered repeating work. thanks anyway, i’ll remember that break.

one question though:  
would:

for(init;condition; next) {  
if (test) {  
break;  
}  
}

would that exit the if statement or the for loop?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 6, 2004, 11:03pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552/4 "2004-04-06T23:03:53Z")

</div>

The [font=courier new]for[/font] statement. The [font=courier new]break[/font] statement will only stop [font=courier new]for[/font], [font=courier new]for…in[/font], [font=courier new]do while[/font] or [font=courier new]while[/font], and [font=courier new]switch[/font].

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2004, 8:33pm UTC](https://forum.kirupa.com/t/ending-a-for-loop-without-using-in-the-condition/106552/5 "2004-04-08T20:33:15Z")

</div>

k, thanx :thumb:
