
-----------------------------------
Tony
Thu Mar 20, 2003 6:45 pm

[tutorial] Procedures + Functions + Processes
-----------------------------------
We all start learning programming in a linear way. Code is executed line after line after line. We can usually skip some lines with an if statement or go back a few with a loop... Remember doing all those flowcharts? Take a look at them; they are all a line from top to bottom (for exceptions of few if statements that have some lines running parallel, but still merging back together).

Linear programming used to be enough, but not always. You want your programs to be dynamic, and have code executed whenever its needed, not when the logic reaches certain point on your 1 way flowchart.

The Solutions:

A)
Procedure
Procedure is a part of the code that can be called upon at any given time. If you have a certain code repeat within the program, it's a good idea to put it inside a procedure as it will use up less resources.


procedure speak()
put "hello"
end speak

speak() %