QUANTAM
Badges: 11
Rep:
?
#1
Report Thread starter 7 years ago
#1
difference between outputting from a program and returning a value? Relating to functions and subroutines perhaps?
0
reply
TSR Learn Together
Badges: 9
Rep:
?
#2
Report 7 years ago
#2
Hi there,

While you're waiting for an answer, did you know we have 300,000 study resources that could answer your question in TSR's Learn together section?

We have everything from Teacher Marked Essays to Mindmaps and Quizzes to help you with your work. Take a look around.

If you're stuck on how to get started, try creating some resources. It's free to do and can help breakdown tough topics into manageable chunks. Get creating now.

Thanks!

Not sure what all of this is about? Head here to find out more.
0
reply
Push_More_Button
Badges: 10
Rep:
?
#3
Report 7 years ago
#3
Perhaps you should explain your question more clearly, but if a program has an output that would usually be intended for the end user. If a program returns a value it will usually be so another part of the program (like a function) can use it.

Let's take this simple program written is pseudocode:
Code:
main(){ 
    output("Please enter a number")
    number input = input_from_keyboard()
    number answer = square_number(input)
    output("Answer is: " answer)
}
square_number(number input){
    number answer = input * input
    return answer
}
We're sending some output to the user asking them to input a number. We're then passing that number to another function that does something with it and then returns it to where it was originally called. We then output that number.
1
reply
Planto
Badges: 16
Rep:
?
#4
Report 7 years ago
#4
URGENT: My homework is late and I don't understand it.
0
reply
QUANTAM
Badges: 11
Rep:
?
#5
Report Thread starter 7 years ago
#5
(Original post by Planto)
URGENT: My homework is late and I don't understand it.
Not hw, checking a past paper question for revision. Teacher is incompetent.
0
reply
QUANTAM
Badges: 11
Rep:
?
#6
Report Thread starter 7 years ago
#6
(Original post by Push_More_Button)
Perhaps you should explain your question more clearly, but if a program has an output that would usually be intended for the end user. If a program returns a value it will usually be so another part of the program (like a function) can use it.

Let's take this simple program written is pseudocode:
Code:
main(){ 
    output("Please enter a number")
    number input = input_from_keyboard()
    number answer = square_number(input)
    output("Answer is: " answer)
}
square_number(number input){
    number answer = input * input
    return answer
}
We're sending some output to the user asking them to input a number. We're then passing that number to another function that does something with it and then returns it to where it was originally called. We then output that number.
Thanks for your help, really helped me understand the question.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Are you tempted to change your firm university choice on A-level results day?

Yes, I'll try and go to a uni higher up the league tables (49)
28.99%
Yes, there is a uni that I prefer and I'll fit in better (14)
8.28%
No I am happy with my choice (94)
55.62%
I'm using Clearing when I have my exam results (12)
7.1%

Watched Threads

View All