Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- When to write a function
- It's never necessary. It's just good programming style.
- I need to do many simple but related operations one after another to perform one complicated task that has a well defined result.
- I need to change the algorithm I have hard coded to the program but I know that if I erase it I can't get the program working again.
- I need to add together two numbers and I repeat that many times in my program.
- I want to test a piece of code separately from the other program.
- I need to complete two unrelated operations with the same data.
- I need to repeat the same procedure with different data.
- Two programs need to do the same kind of calculation.
Add Comment
Please, Sign In to add comment