C++ examples for Function:Function Return
Use a return statement in the middle of a loop.
#include <iostream> using namespace std ; int main(){/*from w w w. ja va2 s . c o m*/ int i = 10; while (true ) { if (i == 0) { return 0; } cout << i << "\n"; i --; } }