Csharp Tutorial Road to a Finished System [Data Types and Variables]


Good Day everyone 😊, We are now here to our third C# programming tutorial
Today we are going to discuss about the Variables and Data Types

Data Types

  • this is the classification or simply the type of a data which tells the compiler how the programmer intends to use the data
  • on simple language we can say that data type is the one which classifies a data, for example a person can be classified as a male or female, can be as a child, teenager or adult. Data types are the classification of the data depending on its use. A data can be classified to many types, however we don't need all its classification.

Variable

  • is something that will change and it was called variable because its varies
    this variables are connected to the data types because it has classification depending of its type
below is a table of data types, what it represents, its range and the default value

Lets start the tutorial, lets open the visual studio and create a console application project. Name the project "CSharp Variable Tutorials"
If you are new to this tutorial series opening and creating a console application project is linked in the previous discussion click here to redirect.

Above is the simple application I have developed

Output

Above is the two (2) generated output of the application

As we can see I have run the program twice, on the first run I have typed the name as "Roronoa Zoro" and on the second run I have typed "Vinsmoke Sanji"
We can see two different generated output, depending on what name we have entered. The project we have made is called a polymorphic algorithm. This algorithm allows to change the state of the application evn the codes didn't change.

Code Review

Declaring Variable


This line of code is the declaration of the variable

  • string is the data type of the variable (this can be string, int, or any other type listed at the table above depending on how we are going to use it)
  • name is the name of the variable (the programmer can change the name of the variable depending on what he want to call the variable)
  • equals (=) sign means that we are assigning a value for the declared variable and,
  • double quotation ("") symbol means that the null or nothing
    I prefer to declare variables with a nothing value because sometimes we use it without specifying its value (just to be safe 😆)

Print Statement


This line of code simply print the statement inside the parenthesis

Assign User Input Value


This line of codes assigns value to our declared variable name, ReadLine reads the next line of characters from the standard input stream. The input stream pertains to the line of characters that the user inputted

Concatenating Output


Concatenation was the linking of something together, in our syntax we can remember that the Write/WriteLine methods write the statement inside the parenthesis. We can distinguish that the variable name is outside the quotation (") symbol this means that the compiler will read it as an object and will not treat as a string statement. The plus (+) symbol links the statements and the variable to each other.

There we go, our second tutorial about the C# programming language. Thank you for reading my tutorial for the day, hope you learn from me and you follow our program that deals in declaring variables.


Here is our previous tutorial in the series:

Csharp Tutorial Road to a Finished System [Introduction]
Csharp Tutorial Road to a Finished System [Hello World]

Special C# Tutorial with MongoDB:

Advance C# Programming with MongoDB


I am part of the @steemitfamilyph Join us
Be a member on our Facebook page -- Click this Link
26906086_10208718864569314_1705464943_o (1).png