Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Structured programming
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Multiple entry=== {{further|Coroutine}} More rarely, subprograms allow multiple ''entry.'' This is most commonly only ''re''-entry into a [[coroutine]] (or [[Generator (computer programming)|generator]]/semicoroutine), where a subprogram yields control (and possibly a value), but can then be resumed where it left off. There are a number of [[Coroutine#Common uses|common uses]] of such programming, notably for [[Stream (computing)|streams]] (particularly input/output), state machines, and concurrency. From a code execution point of view, yielding from a coroutine is closer to structured programming than returning from a subroutine, as the subprogram has not actually terminated, and will continue when called again β it is not an early exit. However, coroutines mean that multiple subprograms have execution state β rather than a single call stack of subroutines β and thus introduce a different form of complexity. It is very rare for subprograms to allow entry to an arbitrary position in the subprogram, as in this case the program state (such as variable values) is uninitialized or ambiguous, and this is very similar to a goto.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)