View unanswered posts | View active topics It is currently Mon Sep 01, 2014 9:41 am






Reply to topic  [ 3 posts ] 
Return command 
Author Message
Rookie

Joined: Sat Jun 15, 2013 7:00 am
Posts: 12
Post Return command
re Friday, June 28 timeline 11:00
I'm confused about the addTen int function in this example.

I understand that the function addTen adds 10 to myValue which starts at 30

Points of confusion...
1. What does PASSED TO USE mean? "After we add 10 to the parameter value THAT WAS PASSED TO USE BY TASK MAIN, ...
2. How do we use the Debugger to verify the correct value was returned?
3. It would be helpful to me to have the program steps numbered and show the values of variables and parameter as the program is executed.

How would I run this program to see the results?


Sat Jul 06, 2013 6:01 pm
Profile
Rookie

Joined: Sat Jun 15, 2013 7:00 am
Posts: 12
Post Re: Return command
I just found the tutorial on Debugging Techniques which answered all my questions about how return works and also how to step thru the program.

http://www.education.rec.ri.cmu.edu/pre ... iques.html


Sat Jul 06, 2013 10:05 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Post Re: Return command
Hi Palione,
Glad you answered most of your questions. Not sure if you figured out (1), so here's some explanation:

Functions have parameters (also called arguments) that are used to supply different values to the function from where the function was called. If a value was used as one of a function's parameters, we say that value "was passed" to the function. So "the parameter value that was passed to use by task main" means the value that task main supplied to the function when it called it. You might be getting caught up on the wording, so an equivalent phrase would be "the parameter value that task main passed for the function to use" or "the parameter value that task main passed to the function."

Cheers,
--Ryan

_________________
Ryan Cahoon
CMU Robotics Academy
RVW Software Developer

Robot Potato Head; Virtual NXT


Sun Jul 07, 2013 9:25 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.