Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRyan Graham
883 Pointswhere do function arguments or parameters get their value from?
So... function needHelpWithParameters ( this stuff in here ) { Where does the value for the argument/parameter come from? }
Or do I create a variable with the value and store the value inside the function ( value here ) {}
Thanks for your time and advice!
1 Answer
Todd Anderson
4,260 PointsHi!
This was hard for me to figure out when I started. The parameters are what you will be modifying or using in your function/method.
It get passed in from outside sources. What you're doing when writing a function or method is setting requirements (parameters) that are needed to satisfy your function/methods call. Does that make sense?
public void newNum(int a){
int a += 1;
}
Here my method newNum will take an integer passed in by either a user or from another aspect of my program and increase it by 1. I hope this helps.