Brek statement and continue statement



public class MainActivity extends AppCompatActivity {

TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = findViewById(R.id.textView);

//break statement

for (int i=1; i<=100; i++){

if (i==10) {
break;
}
textView.append("\n"+i+ "\n");

// continue statement
for (int x=1;x<=10; x++){

if (i==10){
continue;
}
textView.append(""+x);
}

}

}
}

Comments

Popular posts from this blog

Introduction to Array