Welcome back my friends !!
Today we'll go through the second part of this C# series
Last time we left off with Console.WriteLine and Console.ReadKey now we'll combine these with some variables and comments.
Comments are useful for multiple reasons: for exemple they can help other developpers read your code or help you in case you
forgot what a line does or things like those.
Speaking of variables ...these are the 3 main data types of variables
(we'll see the rest of them as we procede into this series):
(EXEMPLES ARE DOWN THE LIST)
- int (integers) : This variable defines only non-decimal numbers (like 1, 3, 4, 5, 259, 4000 etc...).
- var : this is an implicit way of defining data types , unlike int or string (meaning ...in a indirect way or "generic" if you wish).
- string : this variable only accepts text.
Here's an exemple of all 3 of them:(you may want to zoom in with your browser since it's quite small but everything's commented)
always remember the " ; "(it's called "semi-colon") symbol at the end of the variables declaration line.
(There's a semi-colon at the end of every expression statement
and declaration statement, so you MUST NOT put the semi-colon at the end of every line)*
So...All types of variables can be "entered" or defined in 2 ways:
1) The first by first declaring the data type and then assign a value to the variable like this:
x = 2;
2) The second by declaring the data type and assigning the variable a value on the same line like this:
int x = 2;
Both of them are right.
That's all for now.
Thank you for reading
Want to start making money as a white hat hacker? Jump-start your white-hat hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from ethical hacking professionals.