Data Types and Variables
Learn about how types and variables are used in C#
StartKey Concepts
Review core concepts you need to learn to master this subject
Variables and Types
Math.Sqrt()
Arithmetic Operators
Unary Operator
Math.Pow()
.toUpper() in C#
IndexOf() in C#
Bracket Notation
Variables and Types
Variables and Types
string foo = "Hello";
string bar = "How are you?";
int x = 5;
Console.WriteLine(foo);
// Prints: Hello
A variable is a way to store data in the computer’s memory to be used later in the program. C# is a type-safe language, meaning that when variables are declared it is necessary to define their data type.
Declaring the types of variables allows the compiler to stop the program from being run when variables are used incorrectly, i.e, an int
being used when a string
is needed or vice versa.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory