Sorry for the newb question. I'm still learning programming. So I'm using C++, and I need to do something like this:
int n;
do {
n = get_data();
if(n != -1)
send(n);
} while(n != -1);
This is just a sketch. Anyway it doesn't feel real elegant. I have to have my test twice. I could just test once and set a flag, but that doesn't feel real elegant either since I have to check the flag twice. It just seems like there should be a way to do this more easily, since it's so easy what I want to do.