Please have a look at the following code (Java)
while((str=br.readLine())!=null)
{
int tempCounter=0;
for(int i=0;i<str.length();i=i+3)
{
String word = str.substring(i, i+3);
// System.out.println(word);
int insert = db.insert(index, word);
if(insert<0)
{
break;
}
tempCounter++;
}
index++;
System.out.println("Index Updated: "+index);
System.out.println(String.valueOf("Total words in this run: "+tempCounter));
if(index==5)
{
break;
}
}
if insert
is less than 0, the I need to break both for
and while
loops. How can I do this?
Problem here is I need to break "both" loops if insert
is less than 0. And you can't add 2 break
commands one after another, even with labels.