Click to See Complete Forum and Search --> : Exiting
Phobic
Jul 14th, 2000, 11:29 PM
How would I exit a function or procedure? I'm new to this :)
parksie
Jul 15th, 2000, 06:41 AM
Use the return keyword. One thing to note is that you must return a value of the same type as the function's definition:
int myfunc(int i) {
return i;
}
bool anotherfunc(int i) {
if(i > 5) {
return true;
} else {
return false;
}
As you can see from the second example, no other statements are executed.
If you use a void, then you do not need to return anything.
parksie
Jul 16th, 2000, 07:10 AM
It's impossible to return the wrong type because the compiler will whinge at you.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.