You are on page 1of 2

Methods can use other methods. This is called calling a method.

When one method calls another method, it can pass it some information to
work with.

When the second method is finished, it can pass information back to the first
method.

Our Main method doesn't need any information, so its parentheses are empty.

The word void here means that the method doesn't pass or

3:01

return back any information.

System.Console.Write method is used to prompt the user to enter the string.

ust like we called System.Console.Write to tell the console to

0:19

print something to the screen,

0:21

now we need some way to tell the console to allow the user to enter their
response.

0:25

This is called reading from the console, and

0:28

there's a method in the .NET framework for doing just that.

0:31

The method we want is System.Console.ReadLine.

0:37

When this method is called, the console will start recording what

0:40

the user types in until they hit the Return key on the keyboard.

0:44
The Return key marks the end of a line.

0:46

This method doesn't take any parameters, because it doesn't need anything.

0:50

What this method does do is return what the user typed back to our program.

System.Console.ReadLine is a method that returns a string,

Perhaps these descriptions and examples will help:

Declaring a Variable :point_left: Identifying both the type and name of a


variable :point_right: int status;

Assigning a Variable :point_left: Giving the variable a value :point_right:


status = 23;

Initializing a Variable :point_left: Assigning for the first time, may also include
declaring.

String Literal :point_left: A string value that's not a variable :point_right: "You
win!"

Integer Literal :point_left: An integer value that's not a variable :point_right:


23

An example of "initializing" that does not include declaring might be done


inside a constructor to give an instance variable it's starting value.

There's a feature in Visual Studio called the C# Interactive Window.


You can get to it from the top menu by choosing View -> Other
Windows-> C# Interactive Window (all the way at the bottom.)

You can learn a little more about it at the GitHub repo

You might also like