# Experimenting with Procedures and Functions

1. decide which groups of statements perform a single task,
2. convert each group to a procedure, then
3. call the procedures from the main program.
Procedures with parameters to try:
• procedure TimesTable(Number : integer); to write the times table for Number
• procedure DrawStarBoxFill(Length, Width : integer); to draw a filled box of stars
• procedure DrawStarBox(Length, Width : integer); to draw an empty box with a border of stars
• procedure DrawCharBox(Length, Width : integer; Character : char); to draw an empty box with a border of characters
Functions with parameters to try:
• Calculate hypotenuse of right-angled triangle given the lengths of the other two sides
• Area and volume calculations for a range of shapes
• Conversion of the digits 1 to 5 to the corresponding strings 'one' to 'five'
• Function to return the distance given the acceleration and time (s := a * t + 0.5 * a * a;)
• Other equations of motion
• Other equations from Physics such as simple harmonic motion and the lens equation
Programming - a skill for life!

Introduction to Procedures and Functions