Master programming fundamentals level by level, week by week
Master the fundamentals of C# programming - variables, control flow, data structures, and object-oriented basics
Variables, strings, conditionals, and console I/O
Understanding different data types and when to use them
// Integer types
int age = 25; // Whole numbers (-2,147,483,648 to 2,147,483,647)
long population = 8000000000L; // Large whole numbers
short temperature = -15; // Small whole numbers (-32,768 to 32,767)
byte level = 100; // Very small (0 to 255)
// Decimal types
double price = 19.99; // Floating point (15-16 digits precision)
decimal money = 1234.56m; // High precision for money (28-29 digits)
float ratio = 0.75f; // Less precise floating point
// Other value types
bool isActive = true; // true or false
char grade = 'A'; // Single character
DateTime today = DateTime.Now; // Date and time💡 Explanation: Value types store actual data. Use int for whole numbers, double for decimals, bool for true/false, and char for single characters. The m suffix indicates decimal, f indicates float, and L indicates long.
Whole numbers without decimals
Counting, indexing, IDs, ages, quantities
int age = 25; int count = 100;
Numbers with decimals (floating point)
Measurements, calculations, scientific data
double temperature = 98.6; double distance = 5.5;
High precision decimals
Money, financial calculations
decimal price = 19.99m; decimal balance = 1000.50m;
Text and characters
Names, messages, user input, any text
string name = "Alice"; string message = "Hello";