View Single Post
Old 02-25-2013, 11:27 PM   PM User | #5
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Functions in programming are very similar to functions in math. I presume you have not worked with functions in math either otherwise this would be more easily understood.

This article provides a less complicated description comparing the 2.
http://www.mathopenref.com/functionsprog.html

Your professor is correct that your functions should really only perform 1 task. That is the point to a function and why they are so useful in both math and programming. You can create libraries of basic functions that when used together can perform more complicated tasks. A function that performs many different tasks it not as reusable as function that performs a single basic task.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote