Before you start
you must see our previous post My first C++ program
Functions :
Before learning defining functions you must know what is the meaning of functions in programming languages.
What is the meaning of functions in programming ??
Function is a group of statement and it can run more than once in the program .Function is allow set of code to be grouped better as per functionality.One and More than one function is allow in the program .Ever function is defined its own functionality.It can reduce the complexity of program easy to finding the error in the program .Function is also reduce the work,Easy to update.
Defining Functions
In languages other then python its return type or type of function(Ex-Int,float etc) is defined first .But in Python to define function is easy.
Below is the syntax of defining functions
syntax:
def function( arg1,arg1,arg3=default…)
…
…
return value
Function is most basic program of the structure .Function are also design tool for split the complexity into a parts.
for calling any function we can use
function(1,2,3)
for example:
if condition:
def fun(): #define the function
…..
else
def fun(): #or it can define in else
…..
…
fun() #call the function
Previous Next
What to do next:
- click here to see our previous post
- click here to Learn more about c++ .
- subscribe by register Buffercode to learn more about programming languages and please wait for next post.