One thing to watch for with parameters: they can only be used inside their method!

static void YourMethodName(string message) { Console.WriteLine(message); } Console.WriteLine(message); // causes an error!

You’ll see an error like…

error CS0103: The name 'message' does not exist in the current context

When talking to other developers about this type of issue, you might hear the term scope. While the entire concept of scope won’t be covered in this lesson, you should know how it applies here: a parameter’s scope is within its method, which means that the name (message in this case) is only valid within its method. If the parameter name is used outside the method, it has no meaning, so it throws an error.



Try causing an error by using the parameter in VisitPlanets() outside of the method body.

For example, if your parameter is named numberOfPlanets, you could try to print numberOfPlanets in Main().

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?