C Sharp Fundamentals/Hello World

C#
C# is a general-purpose, type-safe, object-oriented programming language. It was developed around 2000 by Microsoft as part of its .NET initiative.

Comments
Comments are bits of text that are not executed. These lines can be used to leave notes and increase the readability of the program.


 * Single-line comments are created with two forward slashes //.
 * Multi-line comments start with /* and end with */. They are useful for commenting out large blocks of code.

Console.ReadLine
The Console.ReadLine method is used to get user input. The user input can be stored in a variable. This method can also be used to prompt the user to press enter on the keyboard.

.NET Platform
.NET is a free, cross-platform, open source developer platform for building many different types of applications.

With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, gaming, and IoT. Whether you’re working in C#, F#, or Visual Basic, your code will run natively on any compatible OS. Different .NET implementations handle the heavy lifting for you.

Console.WriteLine
The Console.WriteLine method is used to print text to the console. It can also be used to print other data types and values stored in variables.

Practice
{What is NOT a good reason to use comments in your code? - Help other people reading the code understand it faster. - Ignore a line of code and see how a program will run without it. - Provide context for why something is written the way it is. + To instruct a computer to execute a block of code.
 * type=""}

{Which statement describes the behavior of the following code? + Outputs the text “Hello Wikiversity!” to the user’s console. - Saves the text “Hello Wikiversity!” into a file called “Console”. - Saves the text “Hello Wikiversity!” in the Console object to be read later. - Reads a line of text from the user via the console.
 * type=""}

{What can you make with C#? - C# can only be used to build websites. - C# can only be used to build mobile apps. + C# can be used to make websites, mobile apps, games, and more. - C# can only be used to build games.
 * type=""}

{Fill in the code below to ask what the user’s favorite color is and to print the response. { Console.WriteLine }("What is your favorite color?"); string response = { Console.ReadLine }; { Console.WriteLine }("Your favorite color is {response}?");
 * type="{}"}

{Which of these is NOT one of the strengths of the C# programming language? - All C# data has an explicitly defined type, which makes programs less error prone. - C# is a general-purpose language suitable for many different types of applications. - C# heavily relies on objects, which helps make C# code more reusable and manageable. + C# is a learning language best suited for hobbyist and beginner programmers only.
 * type=""}