Can somebody out there please explain the difference between a procedure and a function?? I've been handed an assignment that asks me to do a write up explaining what they are, what they do and how they work but these were never explained in class(i haven't missed a single class either) i asked the lecturers for more information on them and just got told to google it and the only information I can find is on wikipedia and even that doesn't explain very much, to throw a spanner into the works the program I'm using (small basic) can't do functions so i have to write up something about programming when the language im using can't do it. I'm stuck in a rut with this one and if there's anyone out there kind enough to explain the difference and/or show an example it would be very much appreciated!
Procedure and Function help
Page 1 of 15 Replies - 1302 Views - Last Post: 21 October 2010 - 05:21 PM
Replies To: Procedure and Function help
#2
Re: Procedure and Function help
Posted 16 October 2010 - 04:38 PM
I'd like to help, but I also want to ensure I'm not doing your homework for you. You say the Wikipedia entry doesn't explain very much, and you need examples.
Here's my problem with the above statement. The Wikipedia entry tells you: a summary of what a function is, motivation, history, modern implementation details, C and C++ examples, Visual Basic examples, recursive use of functions, issue of reentrant functions, closures, and bit of optimization discussion.
I realize the Wikipedia article isn't the best piece of writing, but when you say the above isn't "very much", I don't really believe you.
So you can see how if you just come here and ask for an explanation, and examples, you probably are going to be ignored.
Instead, why don't you tell us what you understood from your research, and what specifically you have not been able to understand? And don't pretend you don't have examples. There are examples on that Wikipedia page. You can also search on Google. For example, there are code searching engines like koders.com and Google I think has some facility for looking for code. If you search on programming languages, you'll run into their documentation which shows code.
If you really have trouble finding information, you need to tell us what you researched, so we can help you improve your research efforts.
Here's my problem with the above statement. The Wikipedia entry tells you: a summary of what a function is, motivation, history, modern implementation details, C and C++ examples, Visual Basic examples, recursive use of functions, issue of reentrant functions, closures, and bit of optimization discussion.
I realize the Wikipedia article isn't the best piece of writing, but when you say the above isn't "very much", I don't really believe you.
So you can see how if you just come here and ask for an explanation, and examples, you probably are going to be ignored.
Instead, why don't you tell us what you understood from your research, and what specifically you have not been able to understand? And don't pretend you don't have examples. There are examples on that Wikipedia page. You can also search on Google. For example, there are code searching engines like koders.com and Google I think has some facility for looking for code. If you search on programming languages, you'll run into their documentation which shows code.
If you really have trouble finding information, you need to tell us what you researched, so we can help you improve your research efforts.
#3
Re: Procedure and Function help
Posted 17 October 2010 - 07:43 AM
What programming language are you working with? Some languages interchange the words function and procedure to mean the same thing, while other languages have a different meaning for them. For example, in SQL, a function has a return value while a procedure does not. But C does not have procedures, only functions. So when someone uses the word procedure for talking about C code, they are using it as a synonym for function. The exact definition your teacher is looking for is dependent on the language you're using.
#4
Re: Procedure and Function help
Posted 17 October 2010 - 10:57 AM
I agree that some websites (and teachers now I think about it) can be vague about that, as they use Functional and Procedural (and Event Driven sometimes) paradigms as synonymous.
#5
Re: Procedure and Function help
Posted 17 October 2010 - 01:09 PM
Darkhack, on 17 October 2010 - 06:43 AM, said:
What programming language are you working with? Some languages interchange the words function and procedure to mean the same thing, while other languages have a different meaning for them. For example, in SQL, a function has a return value while a procedure does not. But C does not have procedures, only functions. So when someone uses the word procedure for talking about C code, they are using it as a synonym for function. The exact definition your teacher is looking for is dependent on the language you're using.
The language im working with is Small Basic. Its a relatively new language that Microsoft brought out to help get people into programming. The thing that was confusing me though was that this is the only programming language I can use and it cant do functions so I can't even play about with to figure it out that way. So when I got asked to write about how a function works I was pure lost! It can do subroutines ok, it just cant return values! I did however manage to get someone to explain it to me eventually so the difference between the two is clear in my head now so mystery solved!
Page 1 of 1

New Topic/Question
Reply



MultiQuote


|