Reputation: 139
public static void main(String[] args) {
// TODO code application logic here
int b=10;
int a= 5;
jmp0:
while (b> 10)
{ if (a>5)
continue jmp0;
else
continue jmp1;
}
jmp1: System.out.print("Zulfi");
}
}
I have a question related to above code. Is using “continue jmp0” same as just using “continue;” in the above code and “continue jmp1;” is giving an error because "jmp1" is outside the block?
Upvotes: 1
Views: 2571
Reputation: 11
If you want to use continue with label then your label must be a loop label.
Upvotes: 0
Reputation: 633
continue
isn't a jump that you can use to go anywhere. It will just move the execution of the code to the start of the loop you have labelled.
Labels are only used to mark loops you'll want to continue to or break from later. Not random lines of code you want to jump to. So yeah, your jmp1
label is totally out of scope
Upvotes: 6