Converting methods to functions or procedures
October 31st, 2011
Comments off
The simplest type of method is one that performs a task without requiring any parameters and without returning any information – let’s call them procedures (or void methods). Methods that use some type as the return value – are functions.
Sometimes, when we declare a method with a return value, we may realize that we don’t actually need this return value, and instead, need a simple void method that does not return anything. On the other hand, we marked a method as void, but may require it to be a function, returning a value.