Back to course

Variables and Fundamental Data Types

.NET Zero to Hero: Master C# and Modern App Development

Variables in C#

Variables are used to store data in memory. C# is a strongly-typed language, meaning every variable must have a type.

Common Types:

  • int: Whole numbers (e.g., 10, -5).
  • double: Decimal numbers (e.g., 19.99).
  • char: Single character (e.g., 'A').
  • string: Sequence of text (e.g., "Hello").
  • bool: True or False.

Syntax:

csharp string name = "John"; int age = 25; bool isDeveloper = true;