Designing Subroutines
Starset provides two types of subroutines (callable code fragments): procedures and function procedures, also known as simply functions.
The difference between procedures and functions dates back to the early days of computing and concerns parameter passing and return values. A procedure is a subroutine that does not return a value (it’s void, as in C/C++) but receives its parameters by reference and can modify them. A function is just the opposite: it always returns a value but receives the parameters by value. The copies of the original parameters essentially become the function’s local variables.
Procedures and Functions | |
|---|---|
|
Procedures and functions in Starset loosely correspond to procedures and functions in Occam. ... | |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access