here is my function, i have 3 conditions to return the requested value back. aside from the message that i print out; i want to know how i can illuminate that what exactly happened when i had a new request to my program, so the behavior of my program is related to the response.
i tried to use "return" command with different numbers, i felt its awkward! is there any better solution?
i tried to use "return" command with different numbers, i felt its awkward! is there any better solution?
Code:
-(NSString*) nextRequest{
if([webSiteQueue count]==0) {
NSLog(@"website queue is empty!");
return 1;
}
if ([webPageQueue count]==0) {
NSLog(@"no link is available! insert new links.");
return 2;
}
if([webPageQueue count]<=linkCounter+1){
NSLog(@"%@'s links are Crawled!",[webSiteQueue objectAtIndex:siteCounter]);
return 3;
}
return [webPageQueue objectAtIndex:linkCounter++];
}