<<< Communication between functions | Index | Procedural programming highlights >>> |
We may need an early return from a function that is void:
void ping() { if ( shot_count > 6 ) return; // early return from ping() ++shot_count; // count each shot std::cout << " ping! "; pong(); return; // redundant -- not required -- and usually a bad style! }
<<< Communication between functions | Index | Procedural programming highlights >>> |