Recent

Programming: Functions Vs Procedures

What is the difference between Functions and Procedures in programming languages?

to understand the difference between functions and procedures we first have to have a look at what are functions and what are procedures.

Functions
functions are the part of today's programming languages in which when we want to use same code again and again, we simply put it into function, then we simply have to call that function whenever we want to use it. Like once we manufactured a printer then whenever want to use to we don't need to manufactured it again we simply use, same concept is for functions, let's we build a simple function which will generate a cube of the given number in C Language, you can use the same concept in other languages like Java, C#, Python, Javascript, PHP and many other languages.

int getcube(int val)
{

return val*val*val;

}

when you call the above getcube() function you will have to put a number whose cube you want, so let's give it some numbers and see what will it return.

code:
getcube(3);

result:
27

code:
getcube(10);

result:
1000

2 comments:

  1. Hi! My new therapist Amina has been nothing but exceptional. I have truly appreciated the time I’ve been able to spend with him over the last month. I look forward to speaking with her every week. She provides great advice that I am able to put into action. Amina is wonderful and makes it very easy to open up. She is good at both listening and engaging in conversation. Thanks to online do i need therapy for the meeting that changed my life.

    ReplyDelete
  2. In programming, functions and procedures both encapsulate blocks of code for reuse. However, functions return a value, promoting modularity and data transformation, while procedures focus on task execution. How Play Games Understanding their distinctions is crucial for efficient, organized, and maintainable code development.

    ReplyDelete