Brian --
No, not unless you are exiting from your PBMain or WinMain function and thereby closing the entire program. Exiting from SUBs or FUNCTIONs that are "below" the "main" function has no effect on open files.
-- Eric
------------------
Perfect Sync: Perfect Sync Development Tools
Email: mailto:[email protected][email protected]</A>
[This message has been edited by Eric Pearson (edited June 05, 2000).]
Announcement
Collapse
No announcement yet.
Exit from sub inside a loop
Collapse
X
-
When I EXIT from SUB does it also close any files that may be open?
Regards,
Brian.
------------------
Leave a comment:
-
Guest repliedI decompiled it using HelpDeco.
Printed it ... and had fun to read..
The problem is, i can't remember all of it so i need the help
------------------
Leave a comment:
-
Guest repliedDarn, I wish I had printed manuals to browse!
Frank
------------------
Leave a comment:
-
But i also wish to point out a great PB feature:
Exit, Exit
Darn, I wish I had printed manuals to browse!
MCM
Leave a comment:
-
Thanks for your help. That will solve a few problems for me.
Regards,
Brian.
------------------
Leave a comment:
-
Guest repliedGood question!
But i also wish to point out a great PB feature:
Exit, Exit
This is possible to leave 2 (different) loops..
Check the help..
This helped me very well and check out iterate as well.
------------------
Leave a comment:
-
It will work fine - you are doing everything perfectly "legally".
PowerBASIC cleans up the stack frame for the sub/function when execution of the sub/function terminates - this is handled automatically for you, and is one of the benefits of using a high-level language like PowerBASIC. In fact, this type of operation is exactly how the EXIT statement is designed let you to work. All memory used by local variables and arrays are automatically released.
The only thing you would have to clean up yourself would be GDI objects (brushes, pens, bitmaps, or Device Contexts, etc) or memory allocations that were created with API functions (GlobalAlloc(), etc), rather than native PowerBASIC code.
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
Exit from sub inside a loop
I need to know if I will cause chaos if I continually exit from a subroutine while in a FOR - NEXT loop or an IF - END IF.
For example:
Sub TEST
FOR b = 1 to 100
IF b = 50 THEN
a$ = "Help"
EXIT SUB
END IF
NEXT b
END SUB
Will this cause a problem if I continually EXIT from the SUB in the middle of the FOR - NEXT loop or the IF - END IF.
I hope someone can actually understand what I mean.
Regards,
Brian.
Tags: None
Leave a comment: