Skip to content
Justice Tech School

Methods

A method has an access level, return type, name and parameters. Expression bodied methods use =>.

Example
static int Square(int n) => n * n;
static string Greet(string name) { return $"Hello {name}"; }
Console.WriteLine(Square(5));
Console.WriteLine(Greet("Ada"));

Exercise

Return type for nothing.

static  Hi() {}

Quiz Test

What does void mean?

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