Skip to Content
Learn
Method Output
Introduction to Method Output

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.

Folder Icon

Take this course for free

Already have an account?