English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how to stop a loop from continuing when having a certain value?

2007-02-12 03:43:07 · 2 answers · asked by khaldon n 1 in Computers & Internet Software

2 answers

if(value is reached)
break;

Use this when you want to exit a loop when you a somewhere in the middle of it. Otherwise, the for and while constructs will break for you.

2007-02-12 03:46:58 · answer #1 · answered by Anonymous · 1 0

You can either use break; statement. Or you can use while/do-while loop

like
while($strValue!="dummytext")
{
$strValue = reset value;
}

or

do
{
$strValue=reset value;
}while($strValue!="dummytext");

2007-02-13 05:13:59 · answer #2 · answered by Atif Majid 3 · 0 0

fedest.com, questions and answers