A function can still useful even if you don't pass any arguments to it and the function dosen't return any value back. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

A function can still useful even if you don't pass any arguments to it and the function dosen't return any value back.

Is this statement true ?

30th Mar 2020, 7:33 PM
MD ZAHID
MD ZAHID - avatar
4 Answers
+ 5
The statement is true.
30th Mar 2020, 10:45 PM
David Carroll
David Carroll - avatar
+ 5
depends on the programming paradigm. For functional languages (strictly pure functions) the whole point of a function is it’s return value. A function with no return value is useless. In other paradigms, e.g. OOP and imperative programming paradigms a function without arguments and return values can be very useful. For example, someObject.destroy(), or invokeGarbageCollector().
31st Mar 2020, 4:35 AM
Jason Stone
Jason Stone - avatar
+ 4
Jason Stone Indeed... you are correct. However, I'm assuming the context is imperative since the question is tagged with "c".
31st Mar 2020, 6:10 AM
David Carroll
David Carroll - avatar
+ 4
David Carroll I did notice that but only right after I posted my comment. And a little more in depth information (probably) won’t hurt.
31st Mar 2020, 6:12 AM
Jason Stone
Jason Stone - avatar