Learning the C# Syntax

Building Blocks

Statements

Statements are the actions that make a program. It means line of codes that perform actions as declaring a variable for example, or calculating a sum of two values or displaying something in the console.

The statements are executing in the so called flow of the program, the first statements, then the next. But not always the order of execution will be the same.

Statements always ends with semicolons ;

Statements that must be written in multiple lines will be surrounded by curly braces {}

Identifiers

In c# everything must have a name, so the identifiers are used to do so. Variables, Classes, Namespaces, and everything else.

The identifiers must start with letters or underscore, but it can contains numbers.

Comments

Comments are used to add extra information in the code

Keywords

Words of special use so these special words can be used as identifiers for example.

Variables

Variable are storage locations that holds a value and each variable must receive a identifier. The name of the variable must be unique for its context of execution.

When we use a variable we will have access to the value stored in it.

Variables can be of various types, like: integer(int), string, date and so on. The type of a variable indicate which type of value it will hold.

Variables are case sensitive and the cammelCase is used as a pattern to write variable names.