Loading your page…
YOUR LEARNING PATH
Short exercises, progressive hints and explanations to help you move forward.
Create a free account to access the lessons and save your progress. Free learning uses daily hearts.
Create my accountAlready have an account? Log inDiscover C# and .NET foundations. Use types, collections and classes to organise programs, then practise LINQ queries.
Before you start: Start with language basics before moving to object-oriented programming.
using System;
class Program {
static void Main() {
int[] values = { 2, 4, 6 };
int total = 0;
foreach (int value in values) total += value;
Console.WriteLine(total);
}
}foreach visits each integer in the array. The sum is stored in total and printed with Console.WriteLine.
Try it: Add a condition to sum only values greater than 3.
Want to understand what each plan includes? Compare plans
C# is a robust, high-performance modern language by Microsoft. It is the primary language for 3D game development in Unity and scalable enterprise backends with .NET.