Articulate C# syntax rules, such as the use of semicolons and curly braces, using statements.
- [Instructor] Getting started with C sharp. This video is for those of you that are new to C sharp. If you've got C sharp experience already, you can probably skip to the next video. If this really is your first glimpse at C sharp code, a few things likely jump out. First, the code is colorful. The more you use Visual Studio, the more you'll come to rely on the color coding. As you learn the colors and how IntelliSense works, IntelliSense is the system that gives you suggestions based on what you've typed so far, you'll be able to easily spot mistakes because some sections of your code won't be colored in as you expect.
The other thing you notice is that the code is neatly organized using tabs. This is not a requirement, but it is recommended. Visual Studio has tools to help you clean up and organize your code with proper indents. Every human language has a vocabulary. That is the unique words that make up the language. For example, hello is a greeting in English. In Spanish, you'd say hola. In Latin, assuming you had a time machine and could go back to Ancient Rome, you'd say salve. Different words for different languages.
Programming languages also have vocabulary words associated with them. These are called key words. You can see them colored here in blue. It isn't important that you memorize all the key words. You just need to know what they are. Later, when we discuss variables, I'll point out that you can't name a variable the same as a key word. Visual Studio also colors in string literals which are required to be enclosed in double quotes. Many languages let you use either a single or a double quote for string literals. C sharp is not one of those languages.
Color coding the literals is significant because it's very easy to make a mistake with your quotation marks when you're working on a long piece of text. A trained eye upon viewing this code would also correctly deduce that C sharp uses block scope. You can see how things are enclosed in curly braces which indicate the scope for each block of code. This isn't uncommon. With the noble exception of Java Script 5, most popular programming languages use block scope. Finally, I'll point out again that at the end of each line there's a semicolon.
This helps the compiler find the end of the statement. Note that you don't have to put semicolons on lines with curly braces.
- Exploring C# on a Mac
- Creating a reusable code library
- Classes and properties
- Loops, arrays, and lists
- Creating a console app
- Creating a command-line app
- Creating a Mac desktop app
- Creating a UI with view controllers and actions