Hello, just to say if I understand this wrong, if you ask me for write a procedure that produces an output i will write this code:
But if you ask me to write a procedure that returns a value I will write
I want to write about this because in the Quizz 3.24 it says:
So i wrote my procedure just printing out the result of the sum of the list, not returning it, just to follow those instructions, but something happened when I tried to submit my code, that was, Try Again!
I this the way grading program is evaluating our code hence marking it as incorrect?
The question is, an output is to print out any value to the screen or an output is return a value?, or both?, in that case how could you realize which one is different?
Just a Question, tell me if I'm wrong.
asked 09 Mar '12, 17:44
Output is to return the value. Print is to print. That one wants you to return the value.
answered 09 Mar '12, 17:54
Hmmm, A procedure that returns a value has much more potential than one that just prints something out.
answered 09 Mar '12, 18:00
If you rewind to the video that introduced procedures, you'll see that a procedure "takes inputs and produces outputs", or something to that effect. You'll notice a certain mathematical taint in the classes. In programming terms, they should say "the procedure returns this and that" rather than "produces outputs". Once you realise this little bias, it gets easier.
answered 09 Mar '12, 18:06