Guide to Game Development/The Programming Language/VB.NET/Basic console input and outputs

If you are still at the main screen of visual studio, then you'll want to follow these steps to create the project.

Where to write your code
You project should look like this:

You want to type all of your programming code in between  and. You don't need to know what these do yet, just know to program between them.

Getting the console to stay open
If you try and run the code by either pressing F5 or clicking the Green Arrow with the word "Start" you'll see that the console will open and close instantly. To fix this you'll need to input:

You should put this at the end of all projects that you work on until told otherwise. Once you press the Enter key while it's running, this will close.

This function has another use that we'll discuss later.

Commenting code
You can write comments in code to help you write notes that won't be compiled. You can do this with an apostrophe ('). You can either write it on a blank line, or at the end of a line of code.

Here's an example:

Outputting a message to the console
To output a message to the console you'll need to use the following:

In programming languages, text (known as a string ) is entered by putting speech marks around it.

All functions need parentheses  after their name like Console.ReadLine and Console.WriteLine, but some functions like Console.WriteLine can have extra information entered into the function, this goes in-between the parentheses. As it's text, it important to use speech marks.

If you were to write the following: Then the output would be: Hello World! It would split it up onto two lines. This is because the Console.Writeline outputs your message, followed by the new line character, this means that any other message will go on the next line. If you don't want to add the new line character, then you can use: This would mean that: would output: Hello World!

Basic variable knowledge
In order to store a user input, we'll need to learn about variables. To make a variable called Var1 which stores a string, write the following:->

We'll go more into variables in the next page.

Storing the input into a variable
This is where the 'second use' of the Console.ReadLine. This gets the user input as well as not shutting the console application. The reason that it doesn't shut the console application is because it's waiting for an input.

To store the user input in the variable, write: If you run this application you won't see much change, this is because there is no additional output so you don't notice it. You'll need to use Console.WriteLine in order to output the variable, when outputting the variable, you shouldn't use speech marks as it's a variable name, not a string (text).

As a whole your program should now look like: A input of: Hello Will output: Hello