C# Programming
Last updated
Last updated
Learned how to build code using visual studio.
Whenever a line of instructions are done, always end with a semi-colon at the end.
The command Console.WriteLine("Hello"); prints out text.
The command Console.ReadLine(); is used to stop the console from terminating after the command is ran.
The command dotnet run, in bash allows the execution of the C# Code.
string <name> = "John"
int <name> = 13; Whole numbers, and negative numbers
int <name>;
<name> = 13;
char <name> = 'A'; This stands for character.
float, double, decimal these represent decimal numbers. They go from least accurate to most accurate.
bool <name> = true or false;
The command Console.ReadLine(); is used to read input that is why it is used to make the application stay still since it is reading the input.
You can assign a variable name the command Console.ReadLine(); command and it will assign it.
Once the variable is declared we can print it out using the Console.WriteLine($"{Variable-name}");
Or alternatively Console.WriteLine("Your name is " + <variablename>)
ORRRR Console.WriteLine("Your name is" + name + " and your " + age + "old");
The syntax of comments are basically the same as C.
Switch statements are easier for validating conditions and executing it rather than having it be a chain of if, else if, else if, else if, else.