Programming Functions and why are they so special

825 views

I’m still trying to wrap my ahead around this concept.

I’ve done basic maths, so I know that f(x) = x is like a function, but I can’t find an intuitive way of explaining why some functions don’t have to return values. In addition, what separates functions from just lines of code?

In: Technology

12 Answers

Anonymous 0 Comments

Technically, all programming functions has outputs, but in some cases we don’t see them:

1. The function requires multiple outputs but the programming language does not support functions with multiple outputs. In this case we get around the problem by using pointer inputs to get their physical addresses.
2. It create an output(s) that is either physical or an essential component in your framework or library. They are either fixed or declared so you can’t define them.
3. Also in object oriented programming you can call “methods” of an object to change its properties. Since properties of the class of the object can be directly accessed by the method there’s no need of returning an output. This is really meaningful because it allow encapsulation.

You are viewing 1 out of 12 answers, click here to view all answers.