Skip to content
Justice Tech School

Local Functions and Lambdas

Functions can live inside methods. Lambdas use =>.

Example
int Add(int a, int b) => a + b;
Func<int, int> dbl = x => x * 2;
Action<string> say = s => Console.WriteLine(s);
say($"{Add(1, 2)} {dbl(4)}");

Exercise

Lambda arrow.

x  x * 2

Quiz Test

What is Func<int, int>?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.