I will update this thread with new tutorials.Quote:
Yea im Zuper.
This tutorial will be made from start (As like u don't know anything about coding at all).
This tutorial is not meant to learn u advanced coding as there is some other great tutorials.
This is for learning basics and starts on coding.
So you can start develope ur own servers.
Lets start out with some basics about coding etc.
(Notice: This is made in c# 2008)
Hello World Tutorial
Okay first you need to create a console application.
File > New project > Console Application.
Then name it to "Hello World"
Now you should get something like this:
Open your Solution Explore.
CTRL + W -> S
Now you can see this:
Notice the program.cs
that is the class ur using.
As u can see in the provious code:
Now in the static void Main(string[] args)
you put all actions that should happen.
Now lets see how we can things like that.
Well for ur very first script you can put a simple string.
String is simply text used in coding.
You put the variables inside the class always.
Variables are the things were using as statements.
(Coming more into this later).
make a static string inside you class, could look like this:
Now your class should look like this:
Now we want the console to write it also.
Then you see the static void Main(string[] args).
To make it write something it should look like this:
Inside the Console.WriteLine(""); you can put the HelloWorld string from before.
Now the class should look like this:
Now press F5, to debug and run it.
Now you will see it writes Hello there world! very fast and close.
Then you can put Console.ReadLine();
After the Console.WriteLine.
ReadLine will stop all following actions, untill u press ENTER.
It should look like this now:
Result:
File > New project > Console Application.
Then name it to "Hello World"
Now you should get something like this:
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Hello_World
{
class Program
{
static void Main(string[] args)
{
}
}
}
CTRL + W -> S
Now you can see this:
Notice the program.cs
that is the class ur using.
As u can see in the provious code:
PHP Code:
class Program
{
static void Main(string[] args)
{
}
}
you put all actions that should happen.
Now lets see how we can things like that.
Well for ur very first script you can put a simple string.
String is simply text used in coding.
You put the variables inside the class always.
Variables are the things were using as statements.
(Coming more into this later).
make a static string inside you class, could look like this:
PHP Code:
static string HelloWorld = "Hello there world!";
PHP Code:
class Program
{
static string HelloWorld = "Hello there world!";
static void Main(string[] args)
{
}
}
Then you see the static void Main(string[] args).
To make it write something it should look like this:
PHP Code:
static void Main(string[] args)
{
Console.WriteLine("");
}
Now the class should look like this:
PHP Code:
class Program
{
static string HelloWorld = "Hello there world!";
static void Main(string[] args)
{
Console.WriteLine(HelloWorld);
}
}
Now you will see it writes Hello there world! very fast and close.
Then you can put Console.ReadLine();
After the Console.WriteLine.
ReadLine will stop all following actions, untill u press ENTER.
It should look like this now:
PHP Code:
class Program
{
static string HelloWorld = "Hello there world!";
static void Main(string[] args)
{
Console.WriteLine(HelloWorld);
Console.ReadLine();
}
}
Bools
What is bools?
bools are used to see if something is true or false.
Is used alot in forms, but you can use it for everything.
Create a new Console Application called Boolean.
Now as in the previous tutorials, u learned about variables.
Now you will learn some more about them and also about local variables.
Okay first we need a variable for the bool.
It could be done like this:
How do u set it true or false then?
As we got it now, then is true.
If u want it false you can put it:
But more of that later.
Now the class should look like this:
Now how can we use it?
To check bools if is true or false.
Use a simple if check.
False checks:
True checks:
Now lets check if it is true.
We use the 2nd way, as thats the most normal to use.
This should be the class now, if u followed it right.
Now you can do a check like else, for what should happen if is not true.
Could be done like this:
Now we need some actions for the code.
Lets make it write "Is true" or "Is not true".
You can do it like u learned in the HelloWorld tutorial with Console.WriteLine.
Now you should have something like this:
Well, we don't want console to close after, so we put a ReadLine in the end of it.
(Before the last } in the void).
You will learn more about voids etc. later.
Now your code should be like this:
Now how can you make it true or false?
You can just use for checking true:
You can just use for checking false:
Result for the true check:
Result for the false check:
bools are used to see if something is true or false.
Is used alot in forms, but you can use it for everything.
Create a new Console Application called Boolean.
Now as in the previous tutorials, u learned about variables.
Now you will learn some more about them and also about local variables.
Okay first we need a variable for the bool.
It could be done like this:
PHP Code:
static bool MyFirstBool;
As we got it now, then is true.
If u want it false you can put it:
PHP Code:
static bool MyFirstBool = false;
Now the class should look like this:
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
}
}
To check bools if is true or false.
Use a simple if check.
False checks:
PHP Code:
!MyFirstBool
MyFirstBool == false
PHP Code:
MyFirstBool
MyFirstBool == true
We use the 2nd way, as thats the most normal to use.
This should be the class now, if u followed it right.
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
if (MyFirstBool == true)
{
}
}
}
Could be done like this:
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
if (MyFirstBool == true)
{
}
else
{
}
}
}
Lets make it write "Is true" or "Is not true".
You can do it like u learned in the HelloWorld tutorial with Console.WriteLine.
Now you should have something like this:
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
if (MyFirstBool == true)
{
Console.WriteLine("Is true");
}
else
{
Console.WriteLine("Is not true");
}
}
}
(Before the last } in the void).
You will learn more about voids etc. later.
Now your code should be like this:
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
if (MyFirstBool == true)
{
Console.WriteLine("Is true");
}
else
{
Console.WriteLine("Is not true");
}
Console.ReadLine();
}
}
You can just use for checking true:
PHP Code:
MyFirstBool = true;
PHP Code:
MyFirstBool = false;
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
MyFirstBool = true;
if (MyFirstBool == true)
{
Console.WriteLine("Is true");
}
else
{
Console.WriteLine("Is not true");
}
Console.ReadLine();
}
}
Result for the false check:
PHP Code:
class Program
{
static bool MyFirstBool;
static void Main(string[] args)
{
MyFirstBool = false;
if (MyFirstBool == true)
{
Console.WriteLine("Is true");
}
else
{
Console.WriteLine("Is not true");
}
Console.ReadLine();
}
}
Tomorrow I will go deeper in:
Code:
- variables - Calculating with + - * / - classes







