Learn

What’s the outcome of calling a method?

Sometimes a message is printed to the console:

Console.WriteLine("Hello World!");

Sometimes a value is returned:

Math.Floor(15.6); // Returns 15

Sometimes a variable is altered:

int number; bool success = Int32.TryParse("10602", out number); // number is 10602 and success is True

If you don’t understand all of the code examples, that’s okay! By the end of this lesson you will be able to:

  • Define methods with output using the return and out keywords
  • Recognize and resolve errors related to method output

Let’s get started!

Instructions

To remind yourself of some earlier concepts about method input, review the code on the right. We assume you are comfortable with these concepts before taking this lesson.

Take this course for free

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?