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 trial
Christopher Miller
614 PointsWhat does call a variable mean?
I've never understood this term, call, in programming. And I hear it all of the time.
I don't understand what it mean, to call a function or a variable?
Can someone please explain what it means?
thanks
3 Answers
rdaniels
27,258 PointsA function is a code snippet that can be called by other code or by itself, or a variable that refers to the function. When a function is called, arguments are passed to the function as input, and the function can optionally return an output. reference: MDN
Christopher Miller
614 PointsSo it sounds like calling is re-using code that was written once with a program, correct?
Sounds like this falls under the computing term, re-usability.
Ingrid Bardales
10,616 PointsYes..you're calling a code that has already been written..you got it!
Christopher Miller
614 PointsTo me, the term calling is confusing. It doesn't make sense.
Ingrid Bardales
10,616 PointsIngrid Bardales
10,616 PointsHi chris, let's say I declare a variable:
flavor = chocolate
and let's say i need to use it later down the program in a method or function... i can "call" it / or to put it another way i/ the method/ or function can access it. Hope this helps!!