C# Foundations
Write a small program, read types, and fix errors.
- First program
A console program starts in Program.cs and runs from the top.
Start · 6 min - Variables
var stores a value under a name you can use again.
Values · 7 min - Decimal
decimal keeps money exact. The m suffix marks a decimal literal.
Numbers · 8 min - Strings
Text lives in quotes. A name without quotes is a variable.
Text · 7 min - Conditions
A comparison is true or false, and if picks a path from that.
Logic · 8 min - Loops
A for loop repeats while its condition stays true.
Logic · 9 min - Arrays
new[] stores values in order, and the first index is 0.
Methods & logic · 8 min - Lists
A list starts empty and grows when you add items.
Methods & logic · 8 min - Methods
A method names a calculation so another line can call it.
Methods & logic · 8 min - Parameters
A parameter is the name a caller fills in.
Methods & logic · 8 min - Console input
ReadLine returns the next prepared line, then null.
Input · 7 min - Diagnostics
Check reports a missing name. Run does not invent a value.
Problems · 8 min - Names
One name, one meaning in the same block.
Review · 6 min - Comments
A comment is for a person. The compiler skips it.
Review · 5 min - Several files
A project can hold a type in one file and the entry in another.
Projects · 8 min - Snapshots
Run freezes the text you had at that moment.
Run · 6 min - A small bill
Add a few decimal amounts and print the total.
Practice · 9 min - Review
You can read a small program, change one value, and run it again.
Review · 10 min - Quotients, remainders, and negative values
Use integer arithmetic to split a quantity and reason about its remainder.
Applied foundations · 15 min - Boolean guards and short-circuit evaluation
Order conditions so later expressions are safe to evaluate.
Applied foundations · 15 min - Switch expressions with explicit boundaries
Turn a small decision table into an exhaustive expression.
Applied foundations · 15 min - Nullable value types and intentional defaults
Represent a missing measurement without confusing it with zero.
Applied foundations · 15 min - Tuple results and deconstruction
Return related results from one calculation without parallel variables.
Applied foundations · 15 min - Named arguments and optional parameters
Make call sites readable without hiding important choices.
Applied foundations · 15 min - Parameter arrays and empty input
Design a small aggregate function that accepts zero or many values.
Applied foundations · 15 min - The Try pattern and out results
Separate successful parsing from the value produced by a parser.
Applied foundations · 15 min - Passing by value and passing by reference
Trace which variable a method is allowed to replace.
Applied foundations · 15 min - Array aliases and independent copies
Choose whether a second variable shares or copies an array.
Applied foundations · 15 min - Indices, ranges, and slice boundaries
Read from the end and create slices with an exclusive upper bound.
Applied foundations · 15 min - Nested loops for rows and columns
Keep coordinates and loop bounds explicit while processing a small matrix.
Applied foundations · 15 min - Continue, break, and a processing sentinel
Distinguish skipping one item from ending a whole loop.
Applied foundations · 15 min - Flags enums and independent capabilities
Represent combinations of small, independent options with bits.
Applied foundations · 15 min - String positions and explicit comparison rules
Search and extract machine-readable text without culture-dependent surprises.
Applied foundations · 15 min - A validated stock summary
Combine parsing, guards, calculations, and reporting in one small program.
Applied foundations · 15 min