Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Congratulations! You've finished the course! You have a complete, working C# program. Let's do a quick review of everything we've learned.
Installing C#
Congratulations! You've finished the course! You have a complete, working C# program. Let's do a quick review of everything we've learned.
You've learned how to define and call methods. You learned how to set a method up to take parameters, and provide arguments when calling the method. And you learned about method return values and how to use them.
static double Add(double first, double second)
{
return first + second;
}
static void Main(string[] args)
{
double sum = Add(5, 3);
Console.WriteLine(sum);
}
You learned about joining strings with concatenation, inserting values into strings with interpolation, and inserting special characters with escape sequences.
Console.WriteLine("a" + "b");
Console.WriteLine($"aaa {DateTime.Now} bbb");
Console.WriteLine("first line\nsecond line");
You learned about the important distinctions between C#'s numeric types, and how to do math operations.
int myInteger = (int)12.75;
Console.WriteLine(myInteger.GetType());
Console.WriteLine((1 + 2) * 3);
And, you learned about comparison operators, and how to use them in if
statements.
static double Price(int quantity)
{
double pricePerUnit;
if (quantity >= 100)
{
pricePerUnit = 1.5;
}
else if (quantity >= 50)
{
pricePerUnit = 1.75;
}
else
{
pricePerUnit = 2;
}
return quantity * pricePerUnit;
}
You need to sign up for Treehouse in order to download course files.
Sign up