0

what is function ?

20th Sep 2016, 4:32 PM
prateek nandwana
2 Answers
+ 2
Functions have a very important part in programming. They are used to avoid repeating code and are also a good way to group similar statements and ideas. Functions are meant to perform different tasks that the program might need. e.g. If I had my main() function taking an input of numbers and printing out the sum, I might want to have an add() function that I can call and then that function can return the sum rather than having my main() function do everything. Functions are a fundamental part of many languages so it's important to know how to use them properly. More about Functions: https://en.wikipedia.org/wiki/Subroutine Subroutine is just another word for function
12th Nov 2016, 9:01 PM
ChrisG
ChrisG - avatar
0
function is group of statements that together perfor a task. every cop program has at last one function which is main().
21st Sep 2016, 6:31 AM
Kazi
Kazi - avatar