What are functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What are functions

language

4th Apr 2018, 4:04 PM
PROMISE
PROMISE - avatar
9 Answers
+ 6
Function is a Group of statements that perform a task Example : void hi(string x) { string name = x; cout << "Hello my name is " << x << endl; } int main() { hi("Mizuki"); // call the function hi("Kazane"); // call the function hi("Yuzuki"); // call the function return 0; } And the outputs is: Hello my name is Mizuki Hello my name is Kazane Hello my name is Yuzuki
4th Apr 2018, 4:19 PM
ZΛRTHΛИ
ZΛRTHΛИ - avatar
+ 5
thanks very much to everyone that responded to my question, learning it bit by bit 😘
4th Apr 2018, 10:02 PM
PROMISE
PROMISE - avatar
+ 4
A typical function consists of its return value type, its name, one or more parameters (including their types), and its body (block of code, including return statement). A function's body is a block of code written for a purpose, it has a certain functionality (hence function), it may process inputs through its arguments, and return the result to its caller (a code that invoked the function), much like you pass flour, yeast & butter (arguments) to a baker (function), and get a bread (return value), had a baker been a function : ) Hth, cmiiw
4th Apr 2018, 4:35 PM
Ipang
+ 3
Sure, ^_^ i am glad i can help...
5th Apr 2018, 12:05 AM
ZΛRTHΛИ
ZΛRTHΛИ - avatar
+ 2
A block of code that can be reused as many times as you want
4th Apr 2018, 4:11 PM
TurtleShell
TurtleShell - avatar
+ 2
if we talk about the functions than we simply say that it is a collection of statement. which are executed when we call it .....
6th Apr 2018, 1:06 PM
Kapil Mewada
Kapil Mewada - avatar
+ 2
A function is a group of statements that together perform a task.
7th Apr 2018, 3:53 AM
Mayuri N. WAGHMARE
4th Apr 2018, 4:30 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 1
blocks of codes that can be declaced within a scope and can be reused (calling funtion)
29th Apr 2018, 7:07 PM
Silent Hills