-
Hello, and welcome to How To: Beginner Programming,
-
a multi-part guide to your first steps in the world of programming
-
In these following episodes, I'll be demonstrating
-
the basic principles of programming,
-
from creating your first application,
-
to developing your own objects.
-
Now, don't worry yet if you have no idea what any of those are,
-
we'll get to that.
-
In the first episode, I'll demonstrate how to set up your
-
programming environment, or "workbench",
-
and run a simple 'hello world' command,
-
commenting on each step throughout
-
so you guys know what's going on.
-
First things first:
-
You'll need an environment to work in, as well as a language to use.
-
Now, this is entirely up to preference,
-
but I'll be using Visual Studio Express, which is available for free.
-
I'll leave a link in the description.
-
It's available from the website for free,
-
and I'll be using C# (pronounced "see sharp") to program.
-
I suggest those of you who have no idea what you're doing,
-
or are first-time learners,
-
also follow along in C#.
-
Otherwise it might get confusing with syntax.
-
Once you've got it downloaded and installed,
-
open it up and start a new project.
-
Now, this will display three basic programming languages.
-
Visual Basic, which I would not recommend,
-
is good for beginners, but it's a bit too simplistic,
-
and not pretty to use, either.
-
Visual C++, which I would not recommend for beginners,
-
because you have to worry about so much [more than C#].
-
For a simple 'hello world' program, C++ is simple enough,
-
but when you get to more stuff it gets a bit more complicated,
-
especially with arrays.
-
Again, we'll get to that in due time,
-
but for now we'll be using C#.
-
Start a console application.
-
Now this is just a basic "black box window" that pops up,
-
and you can input and output text to it.
-
I'll be calling it "HelloWorld"
-
because that's what we're going to be doing with it:
-
outputting "hello world" to the screen...
-
exciting stuff!
-
This has created the project, as well as a "main" method.
-
This is where all of the code we're going to write
-
will be ran from.
-
Every application has one of these ["main" methods].
-
Whenever you run an application,
-
it will look for the "main" method and run whatever is inside.
-
It will continue throughout until it reaches the endpoint.
-
For the purpose of the first video,
-
we're just outputting a message to the console window.
-
To do this, we write
-
"Console.WriteLine()"
-
and then whatever message you want inside here.
-
For the purpose of this, again,
-
"Hello World!"
-
Whenever you're starting a new language,
-
you can usually find a "Hello world" example,
-
to show you the syntax [of the language].
-
So this is accessing the "Console".
-
And using the method, "WriteLine".
-
And passing the value, "Hello World!".
-
Now, every line you write, in most languages,
-
you have to put a semicolon at the end
-
as if to say, "That's the end of the line. No more on this line."
-
Otherwise, (showing an example)...
-
the program won't know what to do.
-
Once we've written this, we need a
-
"Console.ReadLine()"
-
which stops the program from closing,
-
so the user has time to actually read the message, "Hello World!"
-
If we ran the program without "Console.ReadLine()"...
-
it will just open up and instantly close!
-
So we use "Console.ReadLine()", or "Console.Read()"
-
to stop it from closing so we have time to read it.
-
All "Console.ReadLine()" does is it waits for the user
-
to input any text and then press enter.
-
When enter is pressed, the value is passed into the "Console.ReadLine()",
-
and if we had something here, like (example)...
-
The variable will be assigned the value of the user's input.
-
For now, don't worry about that;
-
we're just displaying "Hello World!" to the screen, like this...
-
Press enter when you're done.
-
That's it for a "Hello world"!
-
That's part one of, "How To: Beginner Programming".
-
Further parts will be released shortly,
-
but I'll leave a gap between videos to allow you to ask questions,
-
and I'll answer them at the start of the following part.
-
The gap between the first and second episodes won't be too long.
-
Maybe do a bit of research before the next episode,
-
so you're a bit ahead of everything,
-
and any assumptions I accidentally make will make sense to you.
-
Thanks for watching, and leave any questions in the comment section below,
-
and I'll try to answer them at the start of the next episode.
-
Thanks for watching!
-