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 trialMichael North
2,561 PointsPlease Help I don't understand what a parameter is
I don't understand what a parameter is.
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
EatFly()
{
bool distanceToFly < 10 && > 10;
return distanceToFly;
}
}
}
2 Answers
james south
Front End Web Development Techdegree Graduate 33,271 PointsmyFunc(myParameter){ return myParameter*2 }
a parameter is an internal variable in a function. in your frog constructor, tongueLength is the parameter. it will hold the value passed in (that's the argument) and store it. in my example above, myFunc returns double the value of the argument. so the parameter holds the value passed in, and the return is double that value.
Michael North
2,561 PointsThank you much. Still not fully grasping it, but I think I'll be able to understand it with time. Anyway I believe this code should work, but its asking me to make a method named EatFly and I made it I just don't know what to do.
namespace Treehouse.CodeChallenges { class Frog { public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
EatFly(int distanceToFly)
bool canEatFly == distanceToFly <= TongueLength;
return canEatFly;
}
}