Subroutine

Subing a sub

Breaking a sub into more subs.

Keywords:

Subing a program

Understand subs, by taking an existing program, and break it into pieces

Keywords:

Pinata pricing

Body:

Compute the total price for an order of pinatas.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

More dwarves?

Body:

How many dwarves do you need to match a number of Snow Whites?

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Annual Percentage Yield

Body:

Compute the annual percentage yield.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Body:

Find the roots of a quadratic again, but the Subs.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

h1.

Compute hypotenuse with validation

Body:

Compute the hypotenuse of a right angled triangle, with input validation.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

DRY

DRY stands for Don't Repeat Yourself. One of the Big Ideas of programming.

Big Idea

Don't repeat yourself

Write similar code once. Put it in a Sub. Use params to tell the Sub what to do differently each time the Sub is called.

So far, each of the subs has been called just once per program. Let's do something different.

Retaxing

Remember that strange tax return program? The worksheet: