I was going to make a subroutine, just wasn't sure if I should put everything in it, or only the parts that were **exactly** the same...
Subroutines are useful for avoiding repetition, but the best thing about subroutines is that they let you extract and name a little bit of behavior. Most of my small, single-file programs start out with me declaring main() and then calling a bunch of smaller subroutines from there. I fill them in as I go, and I use their names to describe what they do.
In reply to Re^3: How to implement a Design Pattern/ Strategy??
by chromatic
in thread How to implement a Design Pattern/ Strategy??
by jonc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |