-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (27 loc) · 844 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Program
{
/// <summary>
/// Local functions
/// https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/local-functions
///
/// What's the benefit of local functions?
/// https://www.reddit.com/r/csharp/comments/wi1ifu/whats_the_benefit_of_local_functions/
/// </summary>
public static void Main()
{
int x = 10, y = 5;
int sum = Sum(x, y);
int difference = Difference(x, y);
Console.WriteLine($"The Sum of {x} and {y} is {sum}");
Console.WriteLine($"The Difference of {x} and {y} is {difference}");
int Sum(int x, int y)
{
return x + y;
}
int Difference(int x, int y)
{
return x - y;
}
Console.ReadKey();
}
}