My code throws an error (“missing ;”) and I don’t know why…
int i =0;
while (i < books.size()){
for(i<books.size(); i++){
}
}
My code throws an error (“missing ;”) and I don’t know why…
int i =0;
while (i < books.size()){
for(i<books.size(); i++){
}
}
Are you trying to do a for loop, or a while loop? You probably want a for loop, and not a while loop.
for( int i = 0; i < books.size(); i++ ) {
// Do something in here with books[i].
}
Thanks! I got it to work I do actually want a while loop and I managed to get it to work with
int i =0;
while (i < books.size()){
}
Okay! Just don’t forget to increment i
inside your while loop!