the following code gives me an error of: "expected ';' before '{' token". can anyone see why?
do {
r = rand() % numElements;
} while ([questionsShown containsObject:r] && myCount < numElements) {
//code here…
}
the following code gives me an error of: "expected ';' before '{' token". can anyone see why?
do {
r = rand() % numElements;
} while ([questionsShown containsObject:r] && myCount < numElements) {
//code here…
}
Yes, you have two brackets after your while. Get rid of those. Plus place a semicolon.
do {
r = rand() % numElements;
// code should go here
} while ([questionsShown containsObject:r] && myCount < numElements);
The structure of a do/while loop is so:
do {
//code
} while (condition);
//more code
(Note the semicolon at the end).
Your code looks like:
do {
r = rand() % numElements;
} while ([questionsShown containsObject:r] && myCount < numElements)
{
//code here...
}
See how you're missing a semicolon?